I would like to modify a YUI DataTable as ajax queries get completed. So for example, i have 4 ajax queries querying for things which takes anywhere from 1s to 10s to complete. I would like to start constructing the table when the 1s query finish, and modify the table again every time a ajax query finishes. Is there a recommended way of doing this in general?
In particular, i would like to change how the column is formatted to display any potential errors that occurs while processing a row. However, the error processes slowly, so it would be beneficial to display the data first and then add on the errors later.
Thanks a lot for any help!
Jason
I'm presuming your multiple requests are aggregating column data. I'm also assuming the table is static (not server side paging or sorting).
(pseudo-code ahead)
function callback(data) {
var recordset = myDataTable.getRecordSet(),
records = recordset.getRecords(),
i, len, rec;
for (i = 0, len = records.length; i < len; ++i) {
rec = records[i].getData(); // will return an object literal with data info
/* match the record object to the new data and update the record object */
}
recordset.setRecords(records);
myDataTable.render();
}
So each additional service will add data at the Record level, then the full table UI will be updated.
HTH