I need for a FilterBuilder to display its list of fields hierarchically. So that given a datasource like
the list of fields can be presented for example
I thought a reasonable approach might be one like
When the layout is drawn, my FilterBuilder looks just the way I meant it to. OrderId is selected, operator is set to 'contains', and the right operand is empty. Good.
1) When I switch Order ID's operator to one of the 'field comparators' (e.g., 'matches other field') the right operand presents me with the same old SelectItem. Should it not respect the FieldPickerProperties?
2) When I switch the left operand to anything other than Order ID and then change the operator, I am greeted with the following:
This with power ed. 3.0.p20120303. Where is my mistake, please?
Code:
<fields> <field name="ORDERID" type="sequence" primaryKey="true"> <title>Order ID</title> </field> <field name="CUSTOMERNAME"> <title>Customer Name</title> </field> <field name="ORDERDATE"> <title>Order Date</title> </field> <field name="TRACKINGNUMBER"> <title>Tracking Number</title> </field> </fields>
Code:
Customer Customer Name Order Order ID Order Date
Code:
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.TreeModelType; import com.smartgwt.client.util.KeyCallback; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.FilterBuilder; import com.smartgwt.client.widgets.form.fields.PickTreeItem; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.tree.Tree; import com.smartgwt.client.widgets.tree.TreeNode; public final class TreeFilterEntryPoint implements EntryPoint { private static final String ATTR_NAME = "name"; private static final String ATTR_TITLE = "title"; public void onModuleLoad() { VLayout layout = new VLayout(); layout.setWidth100(); layout.setHeight100(); PickTreeItem pt = new PickTreeItem(); pt.setValueTree(buildTree()); final FilterBuilder filterBuilder = new FilterBuilder(); filterBuilder.setDataSource(DataSource.get("Order")); filterBuilder.setFieldPickerProperties(pt); layout.addMember(filterBuilder); layout.draw(); if (!GWT.isScript()) { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setAltKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new KeyCallback() { public void execute(String keyName) { SC.showConsole(); } }); } } private Tree buildTree() { Tree tree = new Tree(); tree.setModelType(TreeModelType.CHILDREN); tree.setIdField(ATTR_NAME); tree.setNameProperty(ATTR_TITLE); TreeNode orderNodes = new TreeNode("Order"); FieldNode orderIdNode = new FieldNode("ORDERID", "Order ID"); FieldNode orderDateNode = new FieldNode("ORDERDATE", "Order Date"); TreeNode customerNodes = new TreeNode("Customer"); FieldNode customerName = new FieldNode("CUSTOMERNAME", "Customer Name"); customerNodes.setChildren(new TreeNode[] {customerName}); orderNodes.setChildren(new TreeNode[] {orderIdNode, orderDateNode}); tree.setData(new TreeNode[]{orderNodes}); return tree; } private class FieldNode extends TreeNode { public FieldNode(String name, String title) { setAttribute(ATTR_NAME, name); setAttribute(ATTR_TITLE, title); } } }
1) When I switch Order ID's operator to one of the 'field comparators' (e.g., 'matches other field') the right operand presents me with the same old SelectItem. Should it not respect the FieldPickerProperties?
2) When I switch the left operand to anything other than Order ID and then change the operator, I am greeted with the following:
Code:
[ERROR] [TreeFilter] - 17:24:36.869:IFCS7:WARN:Log:TypeError: _3 is undefined Canvas.addFieldValidators(_1=>[object Array]) @ TreeFilter/sc/modules/ISC_Core.js:3576 DynamicForm.addItems(_1=>[object Array]) @ TreeFilter/sc/modules/ISC_Forms.js:289 FilterClause.updateValueItems(_1=>undef, _2=>{Obj}, _3=>"/Order/Order Date") @ TreeFilter/sc/modules/ISC_DataBinding.js:3343 FilterClause.operatorChanged(=>{Obj}) @ TreeFilter/sc/modules/ISC_DataBinding.js:3341 unnamed({Obj}, {Obj}, "equals") @ TreeFilter/sc/modules/ISC_DataBinding.js:3269 FormItem.handleChanged(_1=>"equals") @ TreeFilter/sc/modules/ISC_Forms.js:1389 FormItem.storeValue(_1=>"equals") @ TreeFilter/sc/modules/ISC_Forms.js:1387 FormItem._updateValue("equals") @ TreeFilter/sc/modules/ISC_Forms.js:1384 SelectItem.updateValue() @ TreeFilter/sc/modules/ISC_Forms.js:2355 SelectItem.changeToValue(_1=>"equals", _2=>true) @ TreeFilter/sc/modules/ISC_Forms.js:2346 SelectItem.pickValue(_1=>"equals") @ TreeFilter/sc/modules/ISC_Forms.js:2390 PickListMenu.itemClick(_1=>{Obj}) @ TreeFilter/sc/modules/ISC_Forms.js:2147 PickListMenu.recordClick(viewer=>{Obj}, record=>{Obj}, recordNum=>6, field=>{Obj}, fieldNum=>0, value=>"equals", rawValue=>"equals") @ TreeFilter/sc/modules/ISC_Forms.js:2142 ListGrid.rowClick(record=>{Obj}, rowNum=>6, colNum=>0) @ TreeFilter/sc/modules/ISC_Grids.js:1784 anonymous({Obj}, 6, 0) @ TreeFilter/sc/modules/ISC_Grids.js:1046 GridRenderer._rowClick(6, 0) @ TreeFilter/sc/modules/ISC_Grids.js:843 Class.invokeSuper(_1=>null, _2=>"$29y") @ TreeFilter/sc/modules/ISC_Core.js:307 Class.Super(_1=>"$29y", _2=>[object Arguments]) @ TreeFilter/sc/modules/ISC_Core.js:299 GridBody._rowClick(6, 0) @ TreeFilter/sc/modules/ISC_Grids.js:921 GridRenderer.click({Obj}, undef) @ TreeFilter/sc/modules/ISC_Grids.js:840 Canvas.handleClick({Obj}, undef) @ TreeFilter/sc/modules/ISC_Core.js:3245 [c]EventHandler.bubbleEvent(_1=>{Obj}, _2=>"click") @ TreeFilter/sc/modules/ISC_Core.js:1668 [c]EventHandler.handleClick(_1=>{Obj}) @ TreeFilter/sc/modules/ISC_Core.js:1505 EventHandler._handleMouseUp([object MouseEvent], undef) @ TreeFilter/sc/modules/ISC_Core.js:1492 [c]EventHandler.handleMouseUp(_1=>[object MouseEvent]) @ TreeFilter/sc/modules/ISC_Core.js:1483 [c]EventHandler.dispatch(_1=>isc_c_EventHandler_handleMouseUp, _2=>[object MouseEvent]) @ TreeFilter/sc/modules/ISC_Core.js:1731 anonymous([object MouseEvent]) @ TreeFilter/sc/modules/ISC_Core.js:61 unnamed() @
Comment