views:

615

answers:

1

I have been playing with server side sorting/paging using YUI DataTable, and everything is working as expected.

I want to be able to have something like a form input element to restrict the rows in the table, and my json proxy can handle it, for example:

new YAHOO.util.DataSource("/php/json_proxy.php?")

will return everything, whereas

new YAHOO.util.DataSource("/php/json_proxy.php?var=blah")

will restrict it to only rows with the column var equalling 'blah' show up.

How can I do this without a HTML POST (refresh of the page), i.e. make changes to the datasource's request string via things like a select box, checkbox etc.

Sorry if you can't follow!

+1  A: 

You should be able to accomplish this with the following (assuming myDataTable references your datatable.

// Sends a request to the DataSource for more data
var oCallback = {
    success : myDataTable.onDataReturnInitializeTable,
    failure : myDataTable.onDataReturnAppendRows,
    scope : myDataTable
};
this.myDataSource.sendRequest("var=blah", oCallback);

The section about data retrieval on YUI has a lot of information about this. There's a whole section about retrieving data at runtime.

seth