PDA

View Full Version : Is there a way to disable/mask the grid items?



rkanemeier
18 Dec 2012, 2:09 PM
Is there a "natural" way to disable/mask the contents (items) of a grid? I want to conditionally load a grid as disabled if the user should not be accessing the data. My grid has checkcolumns that I cannot seem to disable individually if they do not have the authority to edit the grid. I found a way to mask the body (which is the entire app) but I only want to mask the rows in the grid (not the top or bottom toolbars).

rkanemeier
18 Dec 2012, 3:04 PM
This is an embarrassing workaround, but it's working. On each of my checkcolumns, i utilized the checkchange listener to check for authority. If the user does not have authority, and they click on one of the columns, I just reverse the checked value. I set a "global variable" (protectRows) to true or false based on whether they should be able to edit the values.

For the approve checkcolumn:



checkchange: function(column, rowIndex, checked) {
record = reviewGrid.store.getAt(rowIndex);
if (protectRows === true) {
record.set('APPROVE', !checked); // reset value to opposite of check/uncheck
checked = false;
} else {
if (checked === true) {
record.set('APPROVE', false);

// update this record in the database
updateApproval(record, column.dataIndex);
}
}
}


For the deny checkcolumn (same thing really):



checkchange: function(column, rowIndex, checked) {
record = reviewGrid.store.getAt(rowIndex);
if (protectRows === true) {
record.set('DENY', !checked); // reset value to opposite of check/uncheck
checked = false;
} else {
if (checked === true) {
record.set('DENY', false);

// update this record in the database
updateApproval(record, column.dataIndex);
}
}
}

friend
19 Dec 2012, 5:33 AM
A simple way to mask just the body of a Grid:



someGridInstance.body.mask();