How can I update the data source without having to completely recreate the table?
Do you mean without using a "new" statement? If so, I haven't had to do this myself, but I use YUI often. I notice that there is a deleteRows method which you could use to delete all the rows, 0 thru the length of the table, and then use the addRows which takes a literal array like yours and an index, 0, in this case.
Have you tried this?
Edit: Take a look at this example. What you want to do can definitely be done. The table is being updated locally at a set interval using the setInterval method (not suprisingly). Taking a look at what setInterval does, you can see that it calls makeConnection on the instance of the data source. The method sounds like it's making a remote call, but it's not necessarily.
Let's take a look at a couple lines from the example.
// Set up polling
var myCallback = {
success: myDataTable.onDataReturnInitializeTable,
failure: function() {
YAHOO.log("Polling failure", "error");
},
scope: myDataTable
}
myDataSource.setInterval(5000, null, myCallback)
the last line could be called once (or on demand as you need) instead of at an interval by rewriting it like this:
myDataSource.makeConnection(null, myCallBack)
which calls the onDataReturnInitializeTable method - which i guess you could call directly which would make more sense.
Anyway, just follow along the example and take out the parts that you don't need. Ultimately it looks like the method onDataReturnInitializeTable is key.
Hope that helps.