Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    keepParentsOnFilter bug, loading doesn't stop

    Hi,

    I have a problem with keepParentsOnFilter, which the following test case demonstrates:

    Environment: v10.1p_2016-01-28, Windows 10, Chrome 49.0.2623.112 m

    Code:
    var ds = DataSource.create({ fields: [{name: 'id'},{name: 'parentId'},{name: 'name'}], cacheData:[
        {id: 1, name:'Folder 1'},
        {id: 2, name:'Folder 2'},
        {id: 3, name:'Folder 3'},
        {id: 5, parentId:1, name:'Leaf 1-1'},
        {id: 6, parentId:1, name:'Leaf 1-2'},
        {id: 7, parentId:3, name:'Leaf 3-1'}
    ], clientOnly:true});
    
    TreeGrid.create({
        showFilterEditor: true, keepParentsOnFilter:true,
        dataSource:ds, autoFetchData: true,
        fields: [
            {name: 'name', canFilter:true, canHide:false}
        ]
    }).show();
    The log contains the following error:
    Code:
    06:28:57.407:INFO:Log:initialized
    06:28:58.369:INFO:Log:isc.Page is loaded
    06:29:59.378:TMR9:WARN:Log:TypeError: _12.$172v is not a function
    Stack from error.stack:
        ResultTree.loadChildrenReply(<no args: exited>) on [ResultTree ID:isc_ResultTree_0 (dataSource: isc_DataSource_0, created by: isc_TreeGrid_0)] @ ISC_DataBinding.js:2141:5
        [c]Class.fireCallback(_1=>Obj, _2=>"dsResponse,data,dsRequest", _3=>Array[3], _4=>[DataSource ID:isc_DataSource_0], _5=>undef) on [Class DataSource] @ ISC_Core.js:300:104
        Class.fireCallback(_1=>Obj, _2=>"dsResponse,data,dsRequest", _3=>Array[3], _4=>undef) on [DataSource ID:isc_DataSource_0] @ ISC_Core.js:368:302
        DataSource.fireResponseCallbacks(_1=>Obj, _2=>Obj, _3=>Obj, _4=>Obj) on [DataSource ID:isc_DataSource_0] @ ISC_DataBinding.js:745:13
        DataSource._completeResponseProcessing(_1=>Obj, _2=>Obj, _3=>Obj, _4=>Obj, _5=>Obj) on [DataSource ID:isc_DataSource_0] @ ISC_DataBinding.js:742:6
        _6(_7=>Obj) on [DataSource ID:isc_DataSource_0] @ ISC_DataBinding.js:603:248
        _11() on [DataSource ID:isc_DataSource_0] @ ISC_DataBinding.js:612:4
        DataSource._asyncCopyLocalResults(_1=>0, _2=>0, _3=>Array[0], _4=>anonymous()) on [DataSource ID:isc_DataSource_0] @ ISC_DataBinding.js:617:15
        DataSource._asyncGetClientOnlyResponse(_1=>Obj, _2=>null, _3=>anonymous()) on [DataSource ID:isc_DataSource_0] @ ISC_DataBinding.js:612:50
        DataSource._handleClientOnlyReply(_1=>Obj, _2=>Obj, _3=>Obj) on [DataSource ID:isc_DataSource_0] @ ISC_DataBinding.js:604:7
        [c]Class.fireCallback(<no args: recursion>)  on [Class RPCManager] @ ISC_Core.js:300:104
        Class.fireCallback(<no args: recursion>)  on [RPCManager ID:builtinApplication] @ ISC_Core.js:368:302
        [c]RPCManager.fireReplyCallback(_1=>Obj, _2=>Obj, _3=>Obj, _4=>Obj) on [Class RPCManager] @ ISC_DataBinding.js:1721:77
        [c]RPCManager.fireReplyCallbacks(_1=>Obj, _2=>Obj) on [Class RPCManager] @ ISC_DataBinding.js:1728:120
        [c]RPCManager.performOperationReply(_1=>Obj, _2=>Obj) on [Class RPCManager] @ ISC_DataBinding.js:1719:13
        RPCManager._performTransactionReply(_1=>1) on [Class RPCManager] @ ISC_DataBinding.js:1699:6
        [c]Class.fireCallback(<no args: recursion>)  on [Class Timer] @ ISC_Core.js:300:104
        Timer._fireTimeout(_1=>"$ir154", _2=>175, _3=>undef) on [Class Timer] @ ISC_Core.js:1356:166
        <anonymous>() @ ISC_Core.js:1353:40
    The steps to reproduce:
    1) Tree is loaded
    2) Enter 2 into the filter field and apply filter
    3) Click on the opener of Folder 2
    4) Loading doesn't stop

    Removing keepParentsOnFilter from the properties makes this problem disappear..

    Thanks.
    Last edited by brevai; 19 Apr 2016, 20:44.

    #2
    Overriding the loadChildren method as below has solved this problem.

    Code:
    var ds = DataSource.create({ fields: [{name: 'id'},{name: 'parentId'},{name: 'name'}], cacheData:[
        {id: 1, name:'Folder 1'},
        {id: 2, name:'Folder 2'},
        {id: 3, name:'Folder 3'},
        {id: 5, parentId:1, name:'Leaf 1-1'},
        {id: 6, parentId:1, name:'Leaf 1-2'},
        {id: 7, parentId:3, name:'Leaf 3-1'}
    ], clientOnly:true});
    
    var sampleTree = TreeGrid.create({
        dataSource:ds, showFilterEditor: true, keepParentsOnFilter:true,
        dataProperties:{
            loadChildren: function(node, callback) {
                var self = this;
                var icon = self.grid.getIcon(node);
                self.grid.setNodeIcon(node, self.grid.loadingIcon);
                self.dataSource.fetchData({parentId: node.id}, function(response){
                    if (0 <= response.status) {
                        self.linkNodes(response.data);
                        self.grid.setNodeIcon(response.clientContext.node, response.clientContext.icon);
                    }
                }, {clientContext:{node:node, icon: icon}});
            }
        },
        fields: [
            {name: 'name', canFilter:true, canHide:false}
        ]
    });
    
    sampleTree.dataProperties.grid = sampleTree;
    sampleTree.fetchData();
    sampleTree.show();

    Comment

    Working...
    X