Skip to content

Instantly share code, notes, and snippets.

@lsmith
Created August 27, 2009 03:34
Show Gist options
  • Save lsmith/176058 to your computer and use it in GitHub Desktop.
Save lsmith/176058 to your computer and use it in GitHub Desktop.
function defaultGenerateRequest(oState, oSelf) {
// Set defaults
oState = oState || { pagination: null, sortedBy: null };
var sort = encodeURIComponent((oState.sortedBy) ? oState.sortedBy.key :
oSelf.getColumnSet().keys[0].getKey()),
dir = (oState.sortedBy &&
oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ?
"desc" : "asc",
startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0,
results = (oState.pagination) ? oState.pagination.rowsPerPage : null;
// Build the request
return "sort=" + sort +
"&dir=" + dir +
"&startIndex=" + startIndex +
((results !== null) ? "&results=" + results : "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment