The server-side pagination example on YDN
uses JSON over XHR(aka, AJAX).
There are a number of other DataTable examples
as well, and Satyam has written some great articles
and hosts even more documentation at http://satyam.com.ar/yui/
Hope this helps,
> I'm sure this has been done a million times, but searching this forum,
> I can't seem to find what I'm looking for. Here is my situation:
> I have a dataTable and I have a AJAX request that goes to the server
> and returns a JSON object to me that will always have the same format,
> possibly just different rows. For all my purposes, it might as well
> be a JS function that is doing server side pagination.
> My issue is that it's not clear to me what the best way to update my
> dataTable is given that I have a new JSON object which I can then
> create a new dataSource from or update an existing dataSource.
> Right now, I basically create a new dataSource with that object and
> then create a new dataTable in the same div to replace the old
> dataTable. This doesn't seem optimal, so I'm wondering if there is a
> way to update the dataSource that a dataTable uses either by updating
> the dataSource the dataTable is initially created with or by creating
> a new dataSource object and just replacing the dataSource object the
> dataTable references.
> Finally, if someone wants to shed some light on how I could streamline
> this whole process better, I'd be interested in that. To be clear,
> the process I am using right now essentially has the user type into a
> textbox, click a button which has a listener that in turn fires a JS
> function that makes an AJAX call. When the AJAX call returns, I want
> to bind the results of that AJAX request to my dataTable. Maybe there
> is a better way to do this all the way around.
> One complication is that I am working within an existing AJAX
> framework. This doesn't mean I wouldn't be willing to change that,
> but that's the reason I started doing things this way. I've noticed
> from the documentation it looks like there are better ways to do this.
> I'm just not sure whether it's worth working outside my existing
> framework or not, but I'm willing to be convinced either way.
> Thanks for any help!