Hi,
I have encoutered the following issue: when using a custom editor with a FormItemIcon in a ListGrid,
the FormItemClickHandlerEvent.getItem().getForm().getParent() is NULL.
When using the same editor in a DynamicForm it works! We need this feature because when clicking the icon we
want to show a certain search window within the correct "context".
I have a standalone test case below which can be used to repro the issue.
FireFox 3.6.13
SC_SNAPSHOT-2011-01-25/EVAL Deployment
Deploy code, double click the record, click the icon that appears and then you will see the Message "The parent is NULL!!!".
I have encoutered the following issue: when using a custom editor with a FormItemIcon in a ListGrid,
the FormItemClickHandlerEvent.getItem().getForm().getParent() is NULL.
When using the same editor in a DynamicForm it works! We need this feature because when clicking the icon we
want to show a certain search window within the correct "context".
I have a standalone test case below which can be used to repro the issue.
FireFox 3.6.13
SC_SNAPSHOT-2011-01-25/EVAL Deployment
Deploy code, double click the record, click the icon that appears and then you will see the Message "The parent is NULL!!!".
Code:
public class Standalone implements EntryPoint { /** * Container for the workspace; */ private static Canvas masterPanel = null; public void onModuleLoad() { //masterPanel should be a Layout // this way, it will re-layout its members if the browser gets resized masterPanel = new Canvas(); masterPanel.setHeight100(); masterPanel.setWidth100(); masterPanel.setStyleName("pageBackground"); //background style from skin DataSource dataSource = new DataSource(); DataSourceField myTextField = new DataSourceField(); myTextField.setName("textField1"); myTextField.setTitle("textField1"); myTextField.setType(new MyTextType()); myTextField.setEditorType(new MyTextEditor()); dataSource.setFields(myTextField); ListGridRecord[] result = new ListGridRecord[1]; result[0] = new ListGridRecord(); result[0].setAttribute("textField1", "test input"); //the order list grid ListGrid ordersList = new ListGrid(); ordersList.setHeight(170); ordersList.setWidth(500); ordersList.setCanEdit(true); ordersList.setDataSource(dataSource); ordersList.setData(result); masterPanel.addChild(ordersList); masterPanel.draw(); } public static class MyTextType extends SimpleType { public MyTextType() { super("myTextType", FieldType.ANY); } } private class MyTextEditor extends TextItem { private String text; public MyTextEditor() { super(); FormItemIcon icon = new FormItemIcon(); icon.setSrc("[SKIN]/actions/edit.png"); icon.addFormItemClickHandler(new FormItemClickHandler() { public void onFormItemClick(FormItemIconClickEvent event) { FormItem formItem =(FormItem) event.getItem(); if(formItem.getForm().getParent() == null){ SC.say("The parent is NULL!!!"); } } }); this.setIcons(icon); this.setShowIcons(true); } } }
Comment