How to pass value from controller to /resourceModel/Collection.php class
-
23-01-2021 - |
Question
There are two table t1 and t2
t1 id, name 1, abc 2, pqr
t2 id, t1_id, phone 1 , 1 , 7894561230 2, 1 , 7894645125 3, 2, 7445582145
I am having two grids, grid 1 showing the first table. Now if i clicked on 1st item. I should see the second grid with only t1_id == clicked item.
Both are UI grid
When i am clicking on an item it call the controller with parameter id. Now how can i filter the other grid with this id?
Solution 2
I found the solution To use session. What i observed was the constructor of the collection was getting called 3 times, this were erassing the data of request params.
OTHER TIPS
As you mentioned you have UI grids, means in the second grid you must have a Dataprovider, you can check there if there is a, id available in the post then you can filter(by using addFieldToFilter() ) it according to id or will show all the data.
And, as you mentioned you have two tables then you can also put a join(by using getSelect()...) to fetch data from both the tables.