Setting a Default Row Based On Specific Column Values

Data sets load their data asynchronously, so you can't just create a data set, fire off a load and then immediately search through the data set for the row with a specific set of values. You have to register a data changed observer on the data set so you can search through the data in the data set *after* it is loaded, and then set the current row. We'll try to make this a bit easier in the future. But till then, this is an example of how to do it.

In this example we are going to load a bunch of names from an XML file into an HTML list, but we want to make sure that the default current row for the data set is the row that refers to the employee with a last name of "Doe" and an id of "5658944". We'll add some conditionals to our list markup to ensure that our "current row" is hilited so we can verify that the 3rd row is indeed the current row. You'll have to view the source of this page to see how this is accomplished.


Here's the running example: