PDA

View Full Version : Coloring and disabling certain Rows in a Grid on load



chrislhardin
6 May 2009, 10:41 AM
I have a Grid and in that data I have a column called "assigned". If the value for assigned in a row is true, I want the row to be colored Gray and disabled from selection. I have it setup now where it deselects the row if assigned is true, but this is not enough. I want to make it grey and disabled when the grid loads the dataset. Anyoen know how??

//View config
loadMask: true,
view: new Ext.grid.GroupingView(),
plugins: filters,
viewConfig: {
forceFit:true,
enableRowBody:true,
showPreview:false,
getRowClass : function(record, rowIndex, p, userStore){
if(this.showPreview){
//p.body = '<p>'+record.data.excerpt+'</p>';
return 'x-grid3-row-expanded';
}
return 'x-grid3-row-collapsed';
}
}


//Row Selection
//This is how we will select our rows in a userGrid
var sm = new Ext.grid.RowSelectionModel({
singleSelect: false,
listeners: {
rowselect: function(sm, row, rec) {
RMA.log.debug("Row: " + row);
RMA.log.debug("Assigned: " + rec.data['assigned']);

if (rec.data['assigned']) {

sm.deselectRow(row);
RMA.log.debug("Deselecting!");
return;
}


rec.data['id']
RMA.log.debug("Row Length: " + sm.getSelections().length);
RMA.rateTemplate.rateMatrix.selectedRow = sm.getSelections();



}
}
});

tryanDLS
6 May 2009, 11:01 AM
http://extjs.com/learn/Ext_Forum_Help#How_to_post_code_properly

Have you read http://extjs.com/learn/Ext_FAQ_Grid