I have a tree grid that display three columns: CC Name, CC Updated By , CC Updated Date
When I filter using Name and Updated By all is fine and works well. The filter works and filter editor displays Name and Updated By for which filter was executed.
If I use Updated Date (Date Item) along with Name and Updated By the filter works the first time but Name and Updated By values are cleared out from filter editor.
I have no idea why filter editor criteria clears out, both name and updated by filter citeria show as spaces in filter editor. I think Treegrid not able to handle AdvancedCriteria and redraw the filter editor. If Simple Criteria is used like name and updated by it works
1. Have the following datasource
2. Have the following TreeGrid
3. Using SmartGWT Power Edition Build 5.1p-2016-08-06
SGWT library to 5.1p - 2016-08-06
Build fixes the bug for FF 48.0.
http://forums.smartclient.com/forum/...ascript-errors
4. Tested on FireFox ESR 24.3.0
5. RPCRequest With Basic Name and Updated By Criteria
6. RPCResponse With Basic Name and Updated By Criteria
All good, the filter works and the filter editor shows the name and updated by criteria which was used for the filter
7. RPCRequest With Name, Updated By and Updated Date Criteria
8. RPCResponse With Name, Updated By and Updated Date Criteria
9. By this time - cc_name and cc_updateby values are cleared out from the filter editor criteria only the date remains in the filter editor.
10. If I update cc_name and cc_updateby and try filtering again with Updated Date criteria still available, I see that the criteria in rpc request quickly build ups
When I filter using Name and Updated By all is fine and works well. The filter works and filter editor displays Name and Updated By for which filter was executed.
If I use Updated Date (Date Item) along with Name and Updated By the filter works the first time but Name and Updated By values are cleared out from filter editor.
I have no idea why filter editor criteria clears out, both name and updated by filter citeria show as spaces in filter editor. I think Treegrid not able to handle AdvancedCriteria and redraw the filter editor. If Simple Criteria is used like name and updated by it works
1. Have the following datasource
Code:
<DataSource ID="ccdata" serverType="sql" tableName="ccdata"> <fields> <field name="cc_id" type="sequence" sequenceName="s_ccdata" primaryKey="true" hidden="true" /> <field name="cc_name" type="ntext" length="128"/> <field name="cc_parentid" sqlType="integer" type="integer" foreignKey="ccdata.cc_id"/> <field name="cc_updateby" type="ntext" length="256"/> <field name="cc_updatedate" sqlType="timestamp" type="datetime"/> <field name="isFolder" sqlType="integer" type="integer" canEdit="false" required="false" nillable ="true" canSave="false" customSelectExpression="(CASE WHEN ((SELECT count(*) FROM ccdata b WHERE b.cc_parentid = ccdata.cc_id) > 0) THEN 'true' ELSE 'false' END )"/> </fields> <operationBindings> <operationBinding operationType="fetch" requiresAuthentication="false" customValueFields="isFolder"> <selectClause> ccdata.*, CASE WHEN ((SELECT count(*) FROM ccdata b WHERE b.cc_parentid = ccdata.cc_id) > 0) THEN 'true' ELSE 'false' END AS isFolder </selectClause> <tableClause> ccdata </tableClause> <whereClause>($defaultWhereClause)</whereClause> </operationBinding> </operationBindings> </DataSource>
Code:
import java.util.ArrayList; import java.util.List; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.FetchMode; import com.smartgwt.client.types.SelectionStyle; import com.smartgwt.client.types.TreeModelType; import com.smartgwt.client.widgets.tree.Tree; import com.smartgwt.client.widgets.tree.TreeGrid; import com.smartgwt.client.widgets.tree.TreeGridField; public class CCDataList extends TreeGrid { /** * Is Folder */ private static final String ISFOLDER = "isFolder"; /** * Default Constructor */ public CCDataList() { super(); this.setWidth100(); this.setHeight100(); this.setShowHeader( Boolean.TRUE ); this.setAutoFitFieldWidths( Boolean.FALSE ); this.setSelectionType( SelectionStyle.SINGLE ); this.setCanEdit( Boolean.FALSE ); this.setCanReparentNodes( Boolean.FALSE ); this.setCanGroupBy( Boolean.FALSE ); this.setCanFreezeFields( Boolean.FALSE ); this.setCanPickFields( Boolean.FALSE ); this.setCanMultiSort( Boolean.FALSE ); this.setCanAutoFitFields( Boolean.FALSE ); this.setDataFetchMode( FetchMode.PAGED ); this.setCanHover( Boolean.TRUE ); this.setShowHover( Boolean.TRUE ); this.setShowHoverComponents( Boolean.TRUE ); this.setShowRoot( Boolean.FALSE ); this.setShowOpenIcons( Boolean.FALSE ); this.setShowDropIcons( Boolean.FALSE ); this.setClosedIconSuffix( "" ); this.setNodeIcon( null ); this.setLoadDataOnDemand( Boolean.TRUE ); this.setAutoFetchData( Boolean.FALSE ); this.setKeepParentsOnFilter( Boolean.FALSE ); final Tree ccTree = new Tree(); ccTree.setDefaultIsFolder( Boolean.FALSE ); ccTree.setModelType( TreeModelType.PARENT ); ccTree.setNameProperty( "cc_name" ); ccTree.setIdField( "cc_id" ); ccTree.setParentIdField( "cc_parentid" ); ccTree.setReportCollisions( Boolean.FALSE ); ccTree.setIsFolderProperty( ISFOLDER ); ccTree.setRootValue( 0 ); this.setDataProperties( ccTree ); final DataSource ds = DataSource.get( "ccdata" ); if ( ds == null ) { return; } this.setDataSource( ds ); final List< TreeGridField > treeGridFieldList = new ArrayList<>(); final TreeGridField ccName = new TreeGridField( "cc_name", "CC Name" ); ccName.setTreeField( true ); ccName.setHidden( Boolean.FALSE ); ccName.setCanFilter( Boolean.TRUE ); treeGridFieldList.add( ccName ); final TreeGridField updatedBy = new TreeGridField( "cc_updateby", "Updated By" ); updatedBy.setCellAlign( Alignment.LEFT ); updatedBy.setHidden( Boolean.FALSE ); updatedBy.setCanFilter( Boolean.TRUE ); treeGridFieldList.add( updatedBy ); final TreeGridField updatedDate = new TreeGridField( "cc_updatedate", "Updated Date" ); updatedDate.setAlign( Alignment.LEFT ); updatedDate.setCellAlign( Alignment.LEFT ); updatedDate.setHidden( Boolean.FALSE ); updatedDate.setCanFilter( Boolean.TRUE ); treeGridFieldList.add( updatedDate ); TreeGridField[] treeGridFields = new TreeGridField[treeGridFieldList.size()]; treeGridFields = treeGridFieldList.toArray( treeGridFields ); this.setFields( treeGridFields ); } }
3. Using SmartGWT Power Edition Build 5.1p-2016-08-06
SGWT library to 5.1p - 2016-08-06
Build fixes the bug for FF 48.0.
http://forums.smartclient.com/forum/...ascript-errors
4. Tested on FireFox ESR 24.3.0
5. RPCRequest With Basic Name and Updated By Criteria
Code:
{ dataSource:"ccdata", operationType:"fetch", componentId:"isc_CCDataList_0", data:{ cc_name:"c1", cc_updateby:"admin", cc_parentid:0 }, startRow:0, endRow:75, sortBy:[ "cc_name" ], textMatchStyle:"exact", resultTree:[ResultTree ID:isc_ResultTree_1 (dataSource: _ccdata, created by: isc_CCDataList_0)], callback:{ caller:[ResultTree ID:isc_ResultTree_1 (dataSource: _ccdata, created by: isc_CCDataList_0)], methodName:"loadChildrenReply" }, willHandleError:true, showPrompt:true, prompt:"Finding Records that match your criteria...", oldValues:{ cc_parentid:0 }, requestId:"_ccdata$62741", internalClientContext:{ parentNode:{ cc_id:0, cc_name:"/", children:Array[0] }, relationship:{ childDS:[DataSource ID:_ccdata], parentDS:[DataSource ID:_ccdata], parentIdField:"cc_parentid", idField:"cc_id" }, childrenReplyCallback:{ }, fetchCount:2 }, fallbackToEval:false, dataFetchMode:"paged", lastClientEventThreadCode:"TMR3", bypassCache:true, dataProtocol:"getParams" }
Code:
{ affectedRows:0, data:[ { isFolder:"true", cc_name:"C1", cc_updatedate:"2016-10-06T18:05:48.000", cc_id:12, cc_updateby:"admin", cc_parentid:0, rowID:1 } ], endRow:1, invalidateCache:false, isDSResponse:true, operationType:"fetch", queueStatus:0, startRow:0, status:0, totalRows:1 }
7. RPCRequest With Name, Updated By and Updated Date Criteria
Code:
{ dataSource:"ccdata", operationType:"fetch", componentId:"isc_CCDataList_0", data:{ operator:"and", criteria:[ { operator:"and", criteria:[ { fieldName:"cc_name", operator:"iEquals", value:"c1" }, { fieldName:"cc_updateby", operator:"iEquals", value:"admin" }, { fieldName:"cc_updatedate", operator:"greaterOrEqual", value:"2016-10-05T04:00:00.000" } ] }, { fieldName:"cc_parentid", value:0, operator:"equals" } ] }, startRow:0, endRow:75, sortBy:[ "cc_name" ], textMatchStyle:"substring", resultTree:[ResultTree ID:isc_ResultTree_1 (dataSource: ccdata, created by: isc_CCDataList_0)], callback:{ caller:[ResultTree ID:isc_ResultTree_1 (dataSource: ccdata, created by: isc_CCDataList_0)], methodName:"loadChildrenReply" }, willHandleError:true, showPrompt:true, prompt:"Finding Records that match your criteria...", oldValues:{ operator:"and", criteria:[ { operator:"and", criteria:[ { fieldName:"cc_name", operator:"iEquals", value:"c1" }, { fieldName:"cc_updateby", operator:"iEquals", value:"admin" }, { fieldName:"cc_updatedate", operator:"greaterOrEqual", value:"2016-10-05T04:00:00.000" } ] }, { fieldName:"cc_parentid", value:0, operator:"equals" } ] }, requestId:"ccdata$62744", internalClientContext:{ parentNode:{ cc_id:0, cc_name:"/", children:Array[1], isFolder:true }, relationship:{ childDS:[DataSource ID:ccdata], parentDS:[DataSource ID:ccdata], parentIdField:"cc_parentid", idField:"cc_id" }, childrenReplyCallback:{ }, fetchCount:5 }, fallbackToEval:false, dataFetchMode:"paged", lastClientEventThreadCode:"TMR6", bypassCache:true, dataProtocol:"getParams" }
Code:
{ affectedRows:0, data:[ { isFolder:"true", cc_name:"C1", cc_updatedate:"2016-10-06T18:05:48.000", cc_id:12, cc_updateby:"admin", cc_parentid:0, rowID:1 } ], endRow:1, invalidateCache:false, isDSResponse:true, operationType:"fetch", queueStatus:0, startRow:0, status:0, totalRows:1 }
10. If I update cc_name and cc_updateby and try filtering again with Updated Date criteria still available, I see that the criteria in rpc request quickly build ups
Code:
{ dataSource:"ccdata", operationType:"fetch", componentId:"isc_CCDataList_0", data:{ operator:"and", criteria:[ { operator:"and", criteria:[ { fieldName:"cc_name", operator:"iEquals", value:"c1" }, { fieldName:"cc_updateby", operator:"iEquals", value:"admin" }, { fieldName:"cc_name", operator:"iEquals", value:"c2" }, { fieldName:"cc_updateby", operator:"iEquals", value:"c2" }, { fieldName:"cc_updatedate", operator:"greaterOrEqual", value:"2016-10-05T04:00:00.000" } ] }, { fieldName:"cc_parentid", value:0, operator:"equals" } ] }, startRow:0, endRow:75, sortBy:[ "cc_name" ], textMatchStyle:"substring", resultTree:[ResultTree ID:isc_ResultTree_1 (dataSource: _ccdata, created by: isc_CCDataList_0)], callback:{ caller:[ResultTree ID:isc_ResultTree_1 (dataSource: _ccdata, created by: isc_CCDataList_0)], methodName:"loadChildrenReply" }, willHandleError:true, showPrompt:true, prompt:"Finding Records that match your criteria...", oldValues:{ operator:"and", criteria:[ { operator:"and", criteria:[ { fieldName:"cc_name", operator:"iEquals", value:"c1" }, { fieldName:"cc_updateby", operator:"iEquals", value:"admin" }, { fieldName:"cc_name", operator:"iEquals", value:"c2" }, { fieldName:"cc_updateby", operator:"iEquals", value:"c2" }, { fieldName:"cc_updatedate", operator:"greaterOrEqual", value:"2016-10-05T04:00:00.000" } ] }, { fieldName:"cc_parentid", value:0, operator:"equals" } ] }, requestId:"_ccdata$62750", internalClientContext:{ parentNode:{ cc_id:0, cc_name:"/", children:Array[0] }, relationship:{ childDS:[DataSource ID:_ccdata], parentDS:[DataSource ID:_ccdata], parentIdField:"cc_parentid", idField:"cc_id" }, childrenReplyCallback:{ }, fetchCount:11 }, fallbackToEval:false, dataFetchMode:"paged", lastClientEventThreadCode:"TMR5", bypassCache:true, dataProtocol:"getParams"
Comment