I want to disable certain rows in dojo dgrid based on one of the cell value.I have used selector and selection mixin of Dgrid.

I am using renderCell function on the particular cell and able to get the cell value.If the cell value is "somedata" ,then I want to disable the row i.e checkbox selector.Please tell me how to achieve this?

     renderCell : function(object, value, node, options) {
    if(value == "somedata" ) {
           //want to disable that row in the grid
      }
有帮助吗?

解决方案

As seen in selector's documentation, you can control the disabling of the checkbox for a particular row by providing a disabled function in the column definition for the selector column. The function receives the full item for the row, so you can base the condition on whatever data within the item you need to.

selector({
    // other properties e.g. field/label here...
    disabled: function (item) {
        return item.someField === "someData";
    }
})

其他提示

You can also override the allowSelect() method in the grid:

allowSelect:function (row) {  
    return true/false; // something based on the row you are passing                   
}

This method gets called by other methods to determine if a row is selectable.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top