Skip to content

Instantly share code, notes, and snippets.

@web-zen
Created August 20, 2009 16:12
Show Gist options
  • Save web-zen/171162 to your computer and use it in GitHub Desktop.
Save web-zen/171162 to your computer and use it in GitHub Desktop.
// Get list of users
var myUsersDataSource = new YAHOO.util.XHRDataSource('db_taskmanager.php?action=select-users'); // instantiate XHRDataSource for Ajax
myUsersDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON; // expect to parse JSON data
myUsersDataSource.responseSchema = {resultsList: "usersList", fields: ["value", "label"]}; // columns to pass into the datatable object
// Define Editors for DataTable
var myEditor = new YAHOO.widget.TextboxCellEditor({disableBtns:false, asyncSubmitter: updateRecord});
var myDDEditor = new YAHOO.widget.DropdownCellEditor({dropdownOptions:myUsersDataSource,disableBtns:true, asyncSubmitter: updateRecord});
//Columns actually displayed in myDataTable
var myColumnDefs = [
{key:"XMLDocID", isPrimaryKey:true, hidden:true},
{key:""},
{key:"Title", label: "Title", sortable: "true", editor: myEditor},
{key:"TaskDesc", label: "TaskDesc", maxAutoWidth: "250", editor: myEditor},
{key:"XMLDocURI", label: "XMLDocURI", maxAutoWidth: "200", editor: myEditor},
{key:"XMLDocFilename", label: "XMLDocFilename", maxAutoWidth: "200", editor: myEditor},
{key:"Author", label: "Author", minWidth: "200", maxAutoWidth: "300", formatter:'lookup', editor: myDDEditor},
{key:"Editor", label: "Editor", maxAutoWidth: "100", formatter:'lookup', editor: myDDEditor},
{key:"Reviewer", label: "Reviewer", maxAutoWidth: "100", formatter:'lookup', editor: myDDEditor},
{key:"Publisher", label: "Publisher", maxAutoWidth: "100", formatter:'lookup', editor: myDDEditor},
{key:"CreatedOn", label: "CreatedOn", maxAutoWidth: "100"},
{key:"UpdatedOn", label: "UpdatedOn", maxAutoWidth: "100"},
{key:"Standard", label: "Standard", maxAutoWidth: "100", editor: myEditor},
{key:'delete', label:' ', className:'delete-button', action:'delete', formatter: delToolTip}
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment