1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Grid<MonType> grid = createMonTypeGrid(listStoreMonType, MonColumnModel);
...
...
GridRowEditing<MonType> gre= new GridRowEditing<MonType>(grid);
...
..
{
gre.addCompleteEditHandler(new CompleteEditHandler<MonType>() {
public void onCompleteEdit(CompleteEditEvent<MonType> event) {
....
ColumnModel<MonType> columnModel = event.getSource().getEditableGrid().getColumnModel();
if ( isNullOrEmpty(gre.getEditor(columnModel .getColumn(COL_OBLIGATOIR_1)).getValue(), FieldTypeEnum.STRING_FIELD) ||
...
isNullOrEmpty(gre.getEditor(columnModel .getColumn(COL_OBLIGATOIR_2)).getValue(), FieldTypeEnum.TYPE_FIELD) ||
...
) {
// si au moins un champ obligatoire est vide => je supprime la ligne
....
...
}
private boolean isNullOrEmpty(Object value, FieldTypeEnum fieldTypeEnum) {
boolean result = false;
if(value == null){
result = true;
}else{
switch (fieldTypeEnum) {
case STRING_FIELD:
result = "".equals(((String)value).trim()) ;
break;
case TYPE_FIELD:
......
}
return result;
} |
Partager