Welcome, Guest
Username: Password: Remember me

TOPIC: Filter reuse in toolbar bug

Filter reuse in toolbar bug 04 Feb 2014 00:43 #12127

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
Hi

I'm creating a component where I use the "reuse" function on many toolbar buttons. I've discovered a bug. The problem accours when I filter a list in the grid and then edit an item.

In the grid view I have e.g. this: filter_client=1 in my URL.
When I edit the first filtered item I have filter_client=1 on the edit page
But when I edit the second filtered item I now get filter_client=2 on the edit page and so forth.

It looks like, it's using the id and not the filter id.

This is a problem when I save and expect to return to my filtered list. I now get a wrong list or an empty list.
The administrator has disabled public write access.

Filter reuse in toolbar bug 04 Feb 2014 10:06 #12132

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
For me it works. I cannot reproduce your problem for the moment.
Can you provide PTL ?

For remembering...

Reuse means that it reuse the current item ID (EDIT), or new generated ID resulting from a 'NEW'

if you set up reuse => filter_client, then CID will be transferred in this filter var. You should use this when you redirect to a page wich the current item is beeing applied as a filter.

In your example, the edited element should be : a Client.

Well, I am not sure to understand well your problem, but I can tell you :
The redirector is much simplier when you see the code, than when you deal with "Reuse", wich does not appear in code.
The redirector can be use as you want in a very simple way.
Open your code and you will probably find where is the problem. Cook has maybe an inconsistency in your special case I would like to check.

I can explain also better what happen when you edit.
Yes the filters are passed to the item, so it pressets the item FK automatically :

ex : .....&cid=34...&filter_client=1

Will open the edit layout with the predefined FK to the specified client passed in url. All FK can be initializated such way, by URL, so you can preset your forms directly from the link.
Coding is now a piece of cake
The administrator has disabled public write access.

Filter reuse in toolbar bug 16 Feb 2014 12:16 #12202

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Do you still can reproduce this ?
Coding is now a piece of cake
The administrator has disabled public write access.

Filter reuse in toolbar bug 17 Feb 2014 11:01 #12211

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
I'll try today and see if I can...
The administrator has disabled public write access.

Filter reuse in toolbar bug 17 Feb 2014 12:38 #12213

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
Ok, I have tested again...

If I do an initial filtering e.g. administrator/index.php?view=clientusers&layout=default&filter_client=1&option=com_xxx
Then I get a list of items for that client

Now I click e.g. new and get administrator/index.php?option=com_xxx&view=clientuser&layout=clientuser (no filter in url?)
When I save and close I'm returned to index.php?option=com_xxx&view=clientusers&layout=default&filter_client=4

Then problem is I'm returned to the list with a new filter. filter_client=4 instead of filter_client=1

It seems like there is a mix/error/bug between client CID (FK) and "client item" CID. In other words, I get item CID returned in filter_client instead of FK CID.
Does it make sense?
Last Edit: 17 Feb 2014 12:57 by dyvel.
The administrator has disabled public write access.

Filter reuse in toolbar bug 17 Feb 2014 13:05 #12214

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Did you forked ? I guess not for the test.

So wich PTL ?
When the filter in missing in URL it can be for various reasons. Nothing is missing and SEF works great.

It depends POST or GET.
It depends on followers.
It depends of permanent vars. (Only POST can change them, since recent 2.6.3)

Another doc in perspective. (I take note of all this)

So, for your problem it might be a wrong generated code at the level of the redirector (controller)
With the PTL I can help you to localize.
Coding is now a piece of cake
The administrator has disabled public write access.

Filter reuse in toolbar bug 17 Feb 2014 13:12 #12215

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
I can produce the behavior in builder/sandbox. What is PTL?

If you are looking at www.j-cook.pro/sandbox/cms32/administrat...option=com_demo10648 and click the item Client users. Then filter on e.g. Client 1, press new - fill name and hit save & close. Then you can reproduce it and perhaps better see what is going on...
The administrator has disabled public write access.

Filter reuse in toolbar bug 17 Feb 2014 15:03 #12216

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
PTL = Project, Table, Layout.

I am checking very soon.
Coding is now a piece of cake
The administrator has disabled public write access.

Filter reuse in toolbar bug 17 Feb 2014 15:13 #12217

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
This is absolutly normal.

What do you want to do with this reuse property on the save task ?
If you want to do this, you must redirect to a layout where the curent CID (Client user) is filtering another table list. (In which Client user is a FK)

Am I clear ?

A documentation is planned here also.
Coding is now a piece of cake
The administrator has disabled public write access.

Filter reuse in toolbar bug 17 Feb 2014 15:37 #12218

  • dyvel
  • dyvel's Avatar
  • Offline
  • Elite Member
  • Posts: 200
  • Thank you received: 11
  • Karma: 10
What I'm looking for was to keep the filter_client ID when I return to the list.

When I create a filtered list and create a new item from the filtered view, I would like to keep using that id when I return. I would also like to use the id in the form page, so it would pre fill the FK item.

I don't see the logic now:

Layout list view with e.g. filter_client = 1
Click new - fill out details - save and close
Same layout list view now has filter_client id of item CID e.g. 4

I can se what happens, but where is the logic in that ?
The administrator has disabled public write access.

Filter reuse in toolbar bug 17 Feb 2014 17:10 #12219

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Reuse means : "Reuse of CID value"
In your case : CID of 'clientuser' (= 4)

So, yes, current item id value is re-injected in the var you specify : filter_client

It is EXACLTY what happens.

But in your context it is really not useful.

This redirector is not able to do all possibilities.
The best is to look at the code and you will understand better.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.100 seconds

Get Started