joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.1] sql custom field - max results from xml

Open alikon opened this issue 1 year ago • 14 comments

Pull Request for Issue # .

Summary of Changes

control max results and max render from fancy-select by xml

Testing Instructions

Create an SQL field.

Use a query that returns more than 10 values that share the same portion of text for "text," for example:

SELECT 1 AS value, 'month-January' AS text
UNION ALL
SELECT 2 AS value, 'month-February' AS text
UNION ALL
SELECT 3 AS value, 'month-March' AS text
UNION ALL
SELECT 4 AS value, 'month-April' AS text
UNION ALL
SELECT 5 AS value, 'month-May' AS text
UNION ALL
SELECT 6 AS value, 'month-June' AS text
UNION ALL
SELECT 7 AS value, 'month-July' AS text
UNION ALL
SELECT 8 AS value, 'month-August' AS text
UNION ALL
SELECT 9 AS value, 'month-September' AS text
UNION ALL
SELECT 10 AS value, 'month-October' AS text
UNION ALL
SELECT 11 AS value, 'month-November' AS text
UNION ALL
SELECT 12 AS value, 'month-December' AS text;

In the Form Layout set as a view "Enhanced Select".

Actual result BEFORE applying this Pull Request

When you try to search for "month" as a value in the field, you only display 10 results as per choice.js default

Expected result AFTER applying this Pull Request

When you try to search for "month" as a value in the field, the number of values returned is governed by the parameters in the Field -> General image

Link to documentations

Please select:

  • [ ] Documentation link for docs.joomla.org:

  • [ ] No documentation changes for docs.joomla.org needed

  • [ ] Pull Request link for manual.joomla.org:

  • [ ] No documentation changes for manual.joomla.org needed

alikon avatar Feb 05 '24 18:02 alikon

why does max-render have JALL but maxresults only have J500

brianteeman avatar Feb 16 '24 17:02 brianteeman

if i read correctly choice.js code there is no -1 for for max-results but i could be wrong

alikon avatar Feb 16 '24 18:02 alikon

maybe so but both fields are the same type and layout

brianteeman avatar Feb 16 '24 18:02 brianteeman

not sure to get your point but 500 max search results are far better than 10 or not ? ❓

alikon avatar Feb 16 '24 18:02 alikon

I am just querying why we have different settings

brianteeman avatar Feb 16 '24 21:02 brianteeman

I am just querying why we have different settings

The current JS setting (without the options) is:

  • Max Result = 10
  • Max Render = -1 (ALL)

Max Result does not support -1 (ALL) so it cannot be included in the list because it would not work. Taking -1 (ALL) out of the Max Render list would limit the number of elements to a maximum of 500, so it would be a loss of functionality. The only solution I see is to leave the 2 different lists.

Razzo1987 avatar Feb 18 '24 16:02 Razzo1987

Thank you for a logical answer

brianteeman avatar Feb 18 '24 16:02 brianteeman

I have tested this item :white_check_mark: successfully on 760c0295eb010240ad957afc5787aa7aa06a539f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

ceford avatar Feb 23 '24 10:02 ceford

I have tested this item :white_check_mark: successfully on 760c0295eb010240ad957afc5787aa7aa06a539f

OK, it works.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

robertolongo avatar Feb 24 '24 09:02 robertolongo

I have tested this item :white_check_mark: successfully on 760c0295eb010240ad957afc5787aa7aa06a539f

all right


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

faustonenci avatar Feb 24 '24 09:02 faustonenci

I have tested this item :red_circle: unsuccessfully on 760c0295eb010240ad957afc5787aa7aa06a539f

Changing firefox to dark mode immediately changes to dark mode in Joomla as well. With or without this patch.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

crimle avatar Feb 24 '24 10:02 crimle

I have tested this item 🔴 unsuccessfully on 760c029Changing firefox to dark mode immediately changes to dark mode in Joomla as well. With or without this patch.

@crimle Are you sure you posted your test result for the right pull request (PR)? I don't see how this PR here is related to dark mode. Please check and report back, and either alter your test result back to "not tested" or ask us to do so for you. Thanks in advance.

richard67 avatar Feb 24 '24 10:02 richard67

I have not tested this item.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

crimle avatar Feb 24 '24 10:02 crimle

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

richard67 avatar Feb 24 '24 10:02 richard67

I wonder, why did you rename the field name? How do you take care about the "old" values, isn't this a B/C break then?

bembelimen avatar Feb 27 '24 23:02 bembelimen

iirc i didn't want to touch com_fields to limit the impact surface of the pr

alikon avatar Feb 28 '24 18:02 alikon

I wonder, why did you rename the field name? How do you take care about the "old" values, isn't this a B/C break then?

Leaving form_layout and binding the 2 options to that tag does not work.
data-* options are loaded only with layout, this xml tag is also documented here, when the limit to fancy was introduced.

To make it work with form_layout com_fields has to be rewritten, which was not intended to be the goal of this PR

Razzo1987 avatar Feb 28 '24 19:02 Razzo1987

Not ready


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

Fedik avatar Mar 05 '24 13:03 Fedik

The PR is not finished. It can go in 5.x, if done properly there no b/c break.

Current XML modifications should be reverted. As we talked with @Razzo1987 And some more changes still need to be done.

Fedik avatar Mar 05 '24 14:03 Fedik

I would add, that the changes should be done for list field first, and then copyed to sql field. Because sql field extends the list field.

Fedik avatar Mar 05 '24 14:03 Fedik

Hi @Fedik, the problem stems from the fact that to fix the bug and continue using form_layout the change on com_fields should be made. If I understand correctly from @alikon he does not feel confident in touching that part. If you can give him support I am also confident that using form_layout avoids b/c breaks.

Razzo1987 avatar Mar 05 '24 16:03 Razzo1987

i would like to make this happen for 5.x not 6.x, let's join together the effort then, the pr it's already open, better,
let's schedule a meet via mattermost on the weekend ? if you can

alikon avatar Mar 05 '24 18:03 alikon

@alikon I made a PR to fix stuff https://github.com/alikon/joomla-cms/pull/49

Fedik avatar Mar 09 '24 11:03 Fedik

thank you @Fedik

alikon avatar Mar 09 '24 17:03 alikon

I have tested this item :white_check_mark: successfully on d736c8804bcd60ca12a9d66c5403d6ce8107afd9

Successfully tested with both List and SQL.

Tested with the example of the 12 months of the year and used the combinations:

  • Max Results: 10, Max Render: ALL: He behaves as he always has
  • Max Results: 100, Max Render: ALL: Show the 12 months by searching "month" (there are less than 100)
  • Max Results: 5, Max Render: 5: Show only 5 months, also by searching "month"
  • Max Results: 100, Max Render: 5: Show only 5 months, by search it show all the 12 months

Another test: if I set the fancy layout before applying the patch now it is retained. Thanks @Fedik

However, I propose to include j500 in the options. For some cases 100 options might be few and we cannot put a consideration for ALL. J500 is 5x the current maximum and seems to me a good compromise.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

Razzo1987 avatar Mar 13 '24 17:03 Razzo1987

However, I propose to include j500 in the options.

It will have a huge performance and usability issue, I think anything more than 20-30 is already to much.

Fedik avatar Mar 14 '24 13:03 Fedik

I have tested this item :white_check_mark: successfully on cdc2480aee53b81ada80e00e25280450d5c024bb


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

Quy avatar Mar 14 '24 18:03 Quy

However, I propose to include j500 in the options.

It will have a huge performance and usability issue, I think anything more than 20-30 is already to much.

I'll try to do a video, but I really don't think it changes much in terms of performance. I have a SQL field that extracts 1500+ records and the latency is related to the query not the limits imposed by the fancy-select

Razzo1987 avatar Mar 15 '24 08:03 Razzo1987

I have tested this item :white_check_mark: successfully on cdc2480aee53b81ada80e00e25280450d5c024bb


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

viocassel avatar Mar 15 '24 21:03 viocassel

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42765.

richard67 avatar Mar 15 '24 21:03 richard67