Hi,
I am using SmartGWT 2.5 Pro.
As mention in the title, I would like to onhold the record remove from the database until the user manually click on the Save button that I implemented. When user hit on the "delete" key, I want to remember that the selected record is to be delete. To do this, I set the following in the ListGrid. Also, I added the KeyPressHandler.
1. setCanRemoveRecords -> false
2. setAutoSaveEdits -> false
However, the record will be deleted from database, when user hit on the "delete" button. How can I disable it and just set the record state to delete (not sure this is doable)?
It is working for edit and add new record.
Sample code as following:
final ListGrid userList = new ListGrid();
userList.setWidth(600);
userList.setHeight(224);
userList.setDataSource(customDS);
userList.setCanEdit(true);
userList.setCanRemoveRecords(false);
userList.setAutoSaveEdits(false);
userList.setLeaveScrollbarGap(false);
userList.setDataFetchMode(FetchMode.LOCAL);
userList.setAutoFetchData(true);
userList.setFields(
new ListGridField("userName"),
new ListGridField("job"),
new ListGridField("email"),
new ListGridField("employeeType"),
new ListGridField("salary")
);
userList.addKeyPressHandler(new KeyPressHandler(){
@Override
public void onKeyPress(KeyPressEvent event) {
if(event.getKeyName().equals("Delete")){
userList.removeData(userList.getRecord(userList.getEventRow()));
}
}
});
Appreciate your help.
I am using SmartGWT 2.5 Pro.
As mention in the title, I would like to onhold the record remove from the database until the user manually click on the Save button that I implemented. When user hit on the "delete" key, I want to remember that the selected record is to be delete. To do this, I set the following in the ListGrid. Also, I added the KeyPressHandler.
1. setCanRemoveRecords -> false
2. setAutoSaveEdits -> false
However, the record will be deleted from database, when user hit on the "delete" button. How can I disable it and just set the record state to delete (not sure this is doable)?
It is working for edit and add new record.
Sample code as following:
final ListGrid userList = new ListGrid();
userList.setWidth(600);
userList.setHeight(224);
userList.setDataSource(customDS);
userList.setCanEdit(true);
userList.setCanRemoveRecords(false);
userList.setAutoSaveEdits(false);
userList.setLeaveScrollbarGap(false);
userList.setDataFetchMode(FetchMode.LOCAL);
userList.setAutoFetchData(true);
userList.setFields(
new ListGridField("userName"),
new ListGridField("job"),
new ListGridField("email"),
new ListGridField("employeeType"),
new ListGridField("salary")
);
userList.addKeyPressHandler(new KeyPressHandler(){
@Override
public void onKeyPress(KeyPressEvent event) {
if(event.getKeyName().equals("Delete")){
userList.removeData(userList.getRecord(userList.getEventRow()));
}
}
});
Appreciate your help.
Comment