refresh datatable

I am going to use YUI datatable with Richfaces ajax.
I have rendered richfaces's rich:dataTable component in the page, then I use this table as datasource to create a yui datatable.
then I use a4j:commandButton to update the rich:dataTable, I added some rows. I want the yui datatable will refresh the latest data.
I tried a lot but didn't succeed, the yui datatable just refreshed with old data (data before I added rows), the new added rows didn't displayed.
can anyone help me, here is my code:

var myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("scriptForm:scriptTable"));
myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
myDataSource.responseSchema = {
fields: [
{ key: "AAA" },
{ key: "BBB" },
{ key: "CCC" }

var myColumnDefs = [
{ key: "AAA" },
{ key: "BBB" },
{ key: "CCC" }
var myDataTable = new YAHOO.widget.DataTable("scriptForm:myContainer", myColumnDefs, myDataSource);

var oCallback = {
success : myDataTable.onDataReturnInitializeTable,
failure : myDataTable.onDataReturnInitializeTable,
scope : myDataTable,
argument: myDataTable.getState() // data payload that will be returned to the callback function

function refresh() {

this.myDataSource.sendRequest(null, oCallback);


<a4j:commandButton value="SUBMIT" reRender="scriptTable" action="#{bean.addRow}"
oncomplete="refresh();" ></a4j:commandButton>

1 Reply

Recent Posts

in General Discussion at YDN