Hello,
if the following 3 conditions apply, a fetch operation is triggered instead of a remove operation:
1. use RestDataSource with JSON format
2. set a custom operationId for remove request
3. call ListGrid::removeSelectedData()
here is a TestCase for reproducing the behaviour:
(SmartGWT 3.1p LGPL 2012/11/30)
if the following 3 conditions apply, a fetch operation is triggered instead of a remove operation:
1. use RestDataSource with JSON format
2. set a custom operationId for remove request
3. call ListGrid::removeSelectedData()
here is a TestCase for reproducing the behaviour:
(SmartGWT 3.1p LGPL 2012/11/30)
Code:
@Override
public void onModuleLoad() {
final ListGrid lg = new ListGrid();
RestDataSource ds = new RestDataSource();
[b]ds.setDataFormat(DSDataFormat.JSON);[/b]
DataSourceField pk = new DataSourceField("pk", FieldType.TEXT);
pk.setPrimaryKey(true);
ds.setFields(pk, new DataSourceField("foo", FieldType.TEXT));
ds.setCacheAllData(true);
ds.setCacheData(new Record() {{
setAttribute("pk", "1");
setAttribute("foo", "bar");
}});
lg.setDataSource(ds);
[b] lg.setRemoveOperation("myRemove");[/b]
lg.setCanRemoveRecords(true);
ToolStrip strip = new ToolStrip();
final ToolStripButton remove = new ToolStripButton("remove");
remove.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@Override
public void onClick(ClickEvent event) {
[b] lg.removeSelectedData();[/b]
}
});
strip.addButton(remove);
lg.setGridComponents(ListGridComponent.HEADER, ListGridComponent.BODY, strip);
lg.fetchData(new Criteria("pk", "1"));
lg.draw();
}
Comment