Saturday, May 5, 2012

Display checkboxes for selected rows using CheckBoxModel in Extjs(Extended javascript Library)

Using CheckBoxModel in Extjs , displays check boxes for all rows of a grid by default.
What if you wanted to disable or hide the check boxes for specific row(s)?

Well this can be done using the renderer function of Ext.selection.CheckboxModel.

   sm = new Ext.selection.CheckboxModel({
              
                checkOnly : true,
                renderer : function(val, meta, record, rowIndex, colIndex, store,view){
                        if( NOT REQUIRED CONDITION){   
                            return null;   
                        }else{
                            meta.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';
                            return '<div class="' + Ext.baseCSSPrefix + 'grid-row-checker">&#160;</div>';
                        }  
                    }
   });

The above code will simply hide the checkboxes for the specific unwanted rows.

 

No comments:

Post a Comment