J4 Issue ?
avatar schnuti
schnuti
17 Aug 2018

Steps to reproduce the issue

This issue is valid for all item lists. You can confirm it (or not) with only a few clicks. If you don't have more than 25 articles test it with the Plugins list.

  • Go to Plugins (the list)
  • You'll get a list with 25 items. At the bottom you'll see the pagination with 4 pages (more or less)
  • Click the Clear button.
  • You'll get a single page with all plugins without pagination.
  • Check the Table Options. It has the number of items set to 25.

clear-button

Expected result

After clicking the Clear button the number of articles shown must be the number set as default.

Actual result

See above.

System information (as much as possible)

Win 10, Xampp, PHP 7.2, Joomla 4.0 (Admitted: not in best shape after my last update)

Additional comments

I noticed this as I had to wait to long for a response from an item list with more than 1000 entries where I never list all.

Edit: Easier way to test.

avatar schnuti schnuti - open - 17 Aug 2018
avatar joomla-cms-bot joomla-cms-bot - change - 17 Aug 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Aug 2018
avatar schnuti schnuti - change - 18 Aug 2018
The description was changed
avatar schnuti schnuti - edited - 18 Aug 2018
avatar joomla-cms-bot joomla-cms-bot - edited - 18 Aug 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 18 Aug 2018
Category com_content
avatar brianteeman brianteeman - change - 18 Aug 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 18 Aug 2018
avatar schnuti
schnuti - comment - 18 Aug 2018

@brianteeman As stated in the title it's a J4 issue not J3.

avatar brianteeman brianteeman - change - 18 Aug 2018
Labels Added: J4 Issue
Removed: J3 Issue
avatar brianteeman brianteeman - labeled - 18 Aug 2018
avatar brianteeman brianteeman - unlabeled - 18 Aug 2018
avatar brianteeman
brianteeman - comment - 18 Aug 2018

(sorry - fat fingers - now fixed)

avatar schnuti schnuti - change - 18 Aug 2018
The description was changed
avatar schnuti schnuti - edited - 18 Aug 2018
avatar schnuti
schnuti - comment - 18 Aug 2018

I found an easier way to test. Use the Plugins list. Edited above.

avatar dgrammatiko
dgrammatiko - comment - 18 Aug 2018

@schnuti is this reproducible in J 3.x as well?

avatar ggppdk
ggppdk - comment - 18 Aug 2018

Explanation

The Model code is the same

But model 's code for populateState() for both J3 and J4 does:

...
$limit =0;
...
Loop through posted data and set model's state
  and inside there it has:
...
			case 'limit':
				$value = $inputFilter->clean($value, 'int');
				$limit = $value;
				break;
...

Thus if you do not post the a list[limit]
(this is what is different in J4, the clear button does not post list[limit]) (in j3 it is posted)
Then $limit = 0; remains unchanged

  • and then the query runs without limit and you get ALL rows listed !!

... and the list[limit] selector since no value was given it loads with default value from XML which is 25 (you do not get the limit from configuration since model's state was set 0 as explained above)

avatar dgrammatiko
dgrammatiko - comment - 18 Aug 2018

Could we use sessionStorage somehow? I mean try to keep the state in the client side

avatar ggppdk
ggppdk - comment - 18 Aug 2018

hhmm,

  • we already using 'list.limit' from session, right ?

i mean 'list.limit' and -all filters- values are used from session when the listing view of the managers is opened (i mean re-navigated to)

but when listing view of the manager is the result of a posted form then model code has the assumption that any-non posted (filter) values need to be cleared (because they are filters !!)

model is treating the list.limit as filter (and usually filters do not have default values!!) aka we are not setting them to anything, but this is wrong because limit has a default value

My suggestion for a fix is do both of these

  1. do J3 approach and post it [EDIT] (or get it from session) , thus keeping the current user value
  2. Furthermore fix the model too in the case that for whatever reason it is not posted , set it to its 's default value from configuration before the loop that sets the filters

aka instead of:
$limit = 0;
do
$limit = $app->get('list_limit');

Please note that the above will not break
list limit "ALL" (aka all rows listing) because in that case you have a posted value , the value '0'

Or you can just do point 2 and not post the value, and every time you click clear you go back to configuration default

avatar schnuti
schnuti - comment - 18 Aug 2018

I would prefer to keep the J3 behaviour. Do not clear list limit and not list order only the filters. I see a difference and the sorting and the list limit should really be kept as set by the user.
I guess removing this from the JS should fix the problem.

avatar schnuti
schnuti - comment - 18 Aug 2018

The filters were more separated from ordering and list limit in the J3 UI but the new Table Options button do not have to change the behaviour of the Clear button.

avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Aug 2018
Build staging 4.0-dev
avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Aug 2018
Status New Discussion
avatar schnuti
schnuti - comment - 20 Aug 2018

@dgrammatiko
This seem to solve the issue.

		if (!self.clearListOptions) {
			self.getListFields().forEach(function(i) {
				i.value = null;
				self.checkFilter(i);
  1. Note the ! Not clear the list data.
  2. The null value prevents data from being sent.
  3. The data used in the php model comes then from the session. (user set or default)

I made this in a J4 version a few weeks okd. In a later version the JS has changed and the CSS classes seem to be out of sync with the JS and harder to change. The list fields are included in the filter fields or something like that.

avatar brianteeman
brianteeman - comment - 22 Jul 2019

@schnuti Do you think you could have another go at fixing this?

avatar schnuti
schnuti - comment - 22 Jul 2019

@brianteeman
I'm not a Javascript guru but I'll have a new look. I hope I still remember some of my findings. I would prefer not to clear ordering and number of items as those are not filters (see J3). The Javascript also tries to set a fixed number (20 I think) and not according to the Global Parameter setting. Personally I never want to clear the ordering just because the filters are changed or cleared. As I remember a HTML-class has to be added for this but would solve this issue.

avatar schnuti
schnuti - comment - 23 Jul 2019

@brianteeman
I think I have a quick and dirty solution = less work. I already find the merge of the list-container (ordering + No items) into the filters-container was a bit quick and dirty. More in the PR.

avatar richard67
richard67 - comment - 23 Jul 2019

PR #25697 is good, I've just tested with success. One more tester please ?

avatar richard67
richard67 - comment - 23 Jul 2019

@schnuti Can this issue be closed now as your PR is ready? Or is there something left to be done?

avatar joomla-cms-bot joomla-cms-bot - change - 24 Jul 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-07-24 17:52:55
Closed_By joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 24 Jul 2019
avatar alikon alikon - change - 24 Jul 2019
Closed_By joomla-cms-bot alikon
avatar joomla-cms-bot
joomla-cms-bot - comment - 24 Jul 2019

Set to "closed" on behalf of @alikon by The JTracker Application at issues.joomla.org/joomla-cms/21676

avatar alikon
alikon - comment - 24 Jul 2019

please test #25697


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

Add a Comment

Login with GitHub to post a comment