Originally posted by Isomorphic
View Post
Originally posted by Isomorphic
View Post
Case A: A *related update* , which did not involve any end user input, suddenly is being DELETED from the listgrid.
vs
Case B: A *related update* , which did not involve any end user input, suddenly is being ADDED to the listgrid.
So why is case A happening, while case B is NOT happening? I see an inconsistency here.
Another inconsistency:
When the relatedUpdate is an add-operation, I immediately see the newly added record in the listGrid: I see the new record at the beginning of the listGrid. So, again, we have an inconsistency here:
For the listGrid, although really an update, the action is an add:
11:36:49.678:XRP4:DEBUG:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):updated cache: 1 row(s) added, 0 row(s) updated, 0 row(s) removed.
So, different than a "real add operation", this listGrid's add operation is NOT being shown immediately in the listGrid, while a *real* add operation is. So, again, this is an inconsistency.
Originally posted by Isomorphic
View Post
Code:
public class MyWindow3 extends Window { private final ListGrid lg; private final IButton switchButton; private Integer actualStatus = 1; TextItem idItem; public MyWindow3() { setWidth(600); setHeight(500); setAutoCenter(true); setIsModal(true); setShowModalMask(true); setShowMaximizeButton(true); VLayout vlayout = new VLayout(12); vlayout.setPadding(25); lg = new ListGrid(); lg.setDataSource(DataSource.get("testDatasource")); lg.setWidth100(); lg.setHeight100(); lg.setSortField("f_id"); lg.setAutoFetchData(false); HLayout buttonsLayout = new HLayout(15); buttonsLayout.setHeight(25); buttonsLayout.setAlign(Alignment.LEFT); DynamicForm df = new DynamicForm(); idItem = new TextItem("id"); idItem.setWidth(40); df.setColWidths(40,40); df.setFields(idItem); buttonsLayout.addMember(df); switchButton = new IButton("Switch status"); switchButton.setWidth(200); switchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { onSwitchButtonClick(); } }); IButton resultSetButton = new IButton("Get resultset length"); resultSetButton.setWidth(200); resultSetButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { SC.say("getResultSet().getLength() = " + lg.getResultSet().getLength()); } }); buttonsLayout.addMember(switchButton); buttonsLayout.addMember(resultSetButton); IButton findButton = new IButton("Find 511"); findButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Record rec = lg.getResultSet().find("f_id", 511); if (rec == null) { SC.say("Not found"); } else { SC.say("Found: " + rec.getAttribute("f_id")); } } }); vlayout.addMember(lg); vlayout.addMember(findButton); Criteria c = new Criteria(); c.addCriteria("f_vertrag_status", 1); lg.fetchData(c, new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { lg.getResultSet().addDataArrivedHandler(new DataArrivedHandler() { @Override public void onDataArrived(DataArrivedEvent event) { SC.say("Data arrived"); } }); } }); vlayout.addMember(buttonsLayout); addItem(vlayout); } private void onSwitchButtonClick() { Record updateRec = new Record(); updateRec.setAttribute("f_id", Integer.parseInt(idItem.getValueAsString())); Integer newStatus = null; if (actualStatus.intValue() == 1) { newStatus = 3; } else { newStatus = 1; } updateRec.setAttribute("f_vertrag_status", newStatus); actualStatus = newStatus; DataSource.get("vertraege").updateData(updateRec, new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { //SC.say("OK"); } }); } }
Code:
public void onDataArrived(DataArrivedEvent event) { SC.say("Data arrived"); }
Example:
1) Assume f_id=511, f_vertrag_status=1 is shown in the listGrid.
2) Write 511 in the textField and push "switch".
3) The row f_id=511 disappears, which is correct, because its new values do not match the actual listGrid's criteria (the new f_vertrag_status = 3).
--> No data arrives, because it is already here!! So the event is not firing.
4) Push "switch" again.
5) The row f_id=511 is NOT appearing. The event is NOT firing. Why not ?
Comment