ydn-js origin

YUI version 2.5.2

Linking DataTables

Challenge

Update a second DataTable in response to a row click of a primary DataTable.

Solution

Subscribe to the primary table's rowClickEvent with a function that calls the second DataTable's DataSource's sendRequest with data pertinent to get the related data.

In this example, all data is stored in the same object, and the detail table's uses a function-type DataSource that pulls the details from the appropriate row of the data collection. It could just as easily be an XHR DataSource and the sendRequest would need to pass the appropriate url completion string as the first param.