var mygrid = new Grid({
editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal', newRowPosition: 'Bottom'},
toolbar: ['Add', 'Delete', 'Update', 'Cancel'],
toolbarClick: mygridToolbarClickHandler,
columns: [
{
field: 'OrderID', isPrimaryKey: true, headerText: 'Order ID', textAlign: 'Right',
validationRules: { required: true, number: true }, width: 140
},
{
field: 'CustomerID', headerText: 'Customer ID',
validationRules: { required: true }, width: 140
},
],
});
mygrid.appendTo('#mygridContainer');
function mygridToolbarClickHandler(args){
console.log(args.item.disabled);
}
grid.toolbarModule.enableItems(['Grid_Collapse', 'Grid_Expand'], true);// enable toolbar items.
function toolbarClickHandler(args) {
// console.log ('toolbarClickHandler');
console.log(args);
[index.js]
grid.toolbarClick = function(args) {
if (this.toolbarModule.toolbar.tbarEle[0].title == "Add") {
var addState =
this.toolbarModule.toolbar.tbarEle[0].getAttribute("aria-disabled") ==
"true"
? true
: false;
this.toolbarModule.enableItems(["submit"], addState); // enable/disable custom toolbar items.
}
}; |