0

I have the following code for adding buttons in ever row of a DataGrid:

structure: [
    {field: 'msConstId', width: '0%', name: 'Milestone',hidden: true},
    {field: 'edit', width: '8%', name: 'Edit',formatter: function(data, rowIndex) { 
         return new dijit.form.Button({style: "width: 80px;",label:"Edit", iconClass:"dijitIconEditTask",showLabel:true, onClick:function(){    updateMilestone.show(); populateUpdateControls(); }});
    }},
    {field: 'delete', width: '10%', name: 'Delete',formatter: function(data, rowIndex) {
         return new dijit.form.Button({style: "width: 80px;",label:"Delete", iconClass:"dijitIconDelete",showLabel:true, onClick:function(){    deleteMilestoneDialog(); }});
    }}
]

The problem is that I want to assign an id to each of the button as "editBtnRowIndex" and "deleteBtnRowIndex". I want to use the id's for enabling and disabling buttons in specific grid rows.

Is that possible?

1 Answers1

0

I had to go with a work around for this by looking at the data in other fields and disabling the button for that row with something like this:

var rowdata = grid.getItem(rowIndex);

rowIndex is passed as param to formatter function.

var val = rowdata.myRowID;
if(val=='specific value') {
   //return disabled button
} else {
   //return enabled button
}