SmartGWT 2.5 LGPL, FireFox 3.6
There is a CanvasItem on the DynamicForm. The DynamicForm is a member of the ValuesManager.
ValuesManager gets data through a call to the editSelectedData(ListGrid).
The problem is that CanvasItem.addShowValueHandler() is not fired then user selects record on the ListGrid.
The very same handler is fired when DynamicForm directly (instaed of ValuesManager) gets data from the ListGrid.
Kindly please see standalone case below:
MichalG
There is a CanvasItem on the DynamicForm. The DynamicForm is a member of the ValuesManager.
ValuesManager gets data through a call to the editSelectedData(ListGrid).
The problem is that CanvasItem.addShowValueHandler() is not fired then user selects record on the ListGrid.
The very same handler is fired when DynamicForm directly (instaed of ValuesManager) gets data from the ListGrid.
Kindly please see standalone case below:
MichalG
Code:
package org.yournamehere.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.Record; import com.smartgwt.client.data.fields.DataSourceTextField; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.ValuesManager; import com.smartgwt.client.widgets.form.fields.CanvasItem; import com.smartgwt.client.widgets.form.fields.events.ShowValueEvent; import com.smartgwt.client.widgets.form.fields.events.ShowValueHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.events.RecordClickEvent; import com.smartgwt.client.widgets.grid.events.RecordClickHandler; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.tab.Tab; import com.smartgwt.client.widgets.tab.TabSet; public class MainEntryPoint implements EntryPoint { public MainEntryPoint() { SC.showConsole(); } public void onModuleLoad() { DataSource ds = new DataSource(); DataSourceTextField field = new DataSourceTextField("testField"); ds.setFields(field); CanvasItem item = new CanvasItem("testField"); item.addShowValueHandler(new ShowValueHandler() { public void onShowValue(ShowValueEvent event) { if (event.getDataValue() != null) { SC.say("Not fired when CanvasItem managed by ValuesManager "+event.getDataValue()); } } }); TabSet ts = new TabSet(); ts.setWidth(500); ts.setHeight(300); Tab tab = new Tab(); tab.setCanClose(true); tab.setTabSet(ts); tab.setTitle("Test VM"); final ValuesManager vm = new ValuesManager(); vm.setDataSource(ds); final DynamicForm df = new DynamicForm(); df.setDataSource(ds); df.setFields(item); vm.addMember(df); tab.setPane(df); Record record = new Record(); record.setAttribute("testField", "test value"); Record[] records = new Record[1]; records[0] = record; final ListGrid lg = new ListGrid(); lg.setWidth(200); lg.setHeight(100); lg.setDataSource(ds); lg.setData(records); lg.addRecordClickHandler(new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { // df.editSelectedData(lg); //this is OK vm.editSelectedData(lg); //this is NOT } }); VLayout main = new VLayout(); main.addMember(lg); main.addMember(ts); main.draw(); } }
Comment