-
-
Save schlomm/0aaa66ed85806695592101259d167d40 to your computer and use it in GitHub Desktop.
DGrid renderCell Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postCreate: function(){ | |
// Create a new constructor by mixing in the components | |
var CustomGrid = declare([ Grid, Keyboard, Selection, GridRegistry ]); | |
var columns = [ | |
{ | |
label : ' ', | |
field : 'deletelink', | |
renderCell: lang.hitch(this, function(object, value, node, options) { | |
var deleteButton = new Button( | |
{ | |
label: "D", | |
onClick: lang.hitch(this, function(state) { | |
var str = object["links"]["delete"]; | |
this.deleteClient(str); | |
}) | |
}); | |
deleteButton.placeAt(node); | |
}), | |
sortable : false | |
}, | |
{ | |
label : 'ID', | |
field : 'ID', | |
sortable : true | |
}, Editor({ | |
label : 'Client Name', | |
field : 'clientname', | |
sortable : true, | |
autoSave: true}, | |
"text", | |
"dblclick") | |
]; | |
// Now, create an instance of our custom grid which | |
// have the features we added! | |
var grid = new CustomGrid({ | |
columns:columns, | |
selectionMode: "single", // for Selection; only select a single row at a time | |
cellNavigation: false // for Keyboard; allow only row-level keyboard navigation | |
}, "clientGrid"); | |
grid.on("dgrid-datachange", lang.hitch(this, function(evt) { | |
this.updateClient(evt.rowId, evt.value); | |
})); | |
// Run any parent postCreate processes - can be done at any point | |
this.inherited(arguments); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment