Skip to content

Instantly share code, notes, and snippets.

@rhyolight
Created January 27, 2009 18:33
Show Gist options
  • Save rhyolight/53458 to your computer and use it in GitHub Desktop.
Save rhyolight/53458 to your computer and use it in GitHub Desktop.
var renderChildTable = function(parentId) {
GRAILSUI.childTable.customQueryString = 'id=' + myParentId;
var newState = {
startIndex: 0,
sorting: { // Sort values
key: 'id', // or whatever you want the default sort on
dir: YAHOO.widget.DataTable.CLASS_ASC
},
pagination : { // Pagination values
recordOffset: 0, // Default to first page when sorting
rowsPerPage: GRAILSUI.childTable.get("paginator").getRowsPerPage()
}
};
// Create callback object for the request
var oCallback = {
success: this.onDataReturnSetRows,
failure: this.onDataReturnSetRows,
scope: this,
argument: newState // Pass in new state as data payload for callback function to use
};
// Send the request
GRAILSUI.childTable.getDataSource().sendRequest(GRAILSUI.childTable.buildQueryString(newState), oCallback);
};
GRAILSUI.parentTable.subscribe('rowClickEvent', function(e) {
var selectedRows = this.getSelectedRows();
var parentId = this.getRecord(selectedRows[0]).getData().id;
renderChildTable(parentId);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment