I have a datatable ‘books’ that is filled with records, lets say book_id, author_id, author_name and title. When i select one book with id=1234 then another datatable ‘checkouts’ (which is initally empty) fetches data from the server and shows every checkout (date, person_id, name, etc) accessed that particular book.
What i did is bound an ‘onAfterSelect’ event to the ‘books’ grid and got the id of the book. then i use $$(‘checkouts’).load(‘checkouts.php?book_id=1234’)
is there another way of doing it?
i am asking this because at further interaction might create other components that would be dependent on $$(‘books’) selection.
I don’t want $$(‘books’) to know anything about other controls but rather have those controls subscribe/register themselves as listeners to $$(‘books’) “onAfterSelect” event
This is great, somehow i kept missing this part of documentation.
One remark though. In my case (other than example above) the master table1 does not have a meaningful id - it’s more of joined view of multiple entities. the query for Table2 needs values from more than one columns from table1. My solution was to use a function for dataFeed property and access selected item from table1 directly.
I wonder why is that second argument supplied? I would rather have the whole row (selected item), so that i can do something with the values other than id. And it would be really great if there was yet one more argument - the master object itself - table1. Because who says that a view can’t have multiple masters?
Lets say i have a list of all Hollywood studios in one list (master1) and a tree of genres (master2) and a grid of movies (common_slave).
Or should i look at it differently? I am still trying to grok “the webix way” of doing things.
It just shows how badly i read documentation. I actually have seen usage of a function as second argument to bind(). And i thought i understood it’s applications well enough. Apparently no!
On the other hand some documentations are better then others