We have been using the CheckBoxSelectionModel in a Grid of GXT. We want to have a particularly checkbox of some row to be checked and disabled, that is, the checkbox of CheckBoxSelectionModel will be selected and grayed-out, and user couldn't select or deselect it.
CheckBoxSelectionModel sm = new CheckBoxSelectionModel<ModelData>();
ColumnConfig checkBoxColumn = sm.getColumn();
checkBoxColumn.setStyle("vertical-align: middle;");
checkBoxColumn.setRenderer(new GridCellRenderer<ModelData>()
{
@Override
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grid)
{
// if the code property of model is 1 then select and disable it
if (model.get("code").equals(1))
{
sm.select((BaseModel) model, true);
return "<div> </div>";
} else { // others case
return "<div class=\"x-grid3-row-checker\"> </div>";
}
}
});
columnConfigs.add(checkBoxColumn);
We have tried the above code from this link suggested, but this will hide the checkbox which is not what we needed.
Don't know if there has any other more properly way to disable the checkbox of the CheckBoxSelectionModel?
Any help is appreciated.
Aucun commentaire:
Enregistrer un commentaire