Announcement

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

    Tree.getFilteredTree correct usage

    Hello Isomorphic, I'm facing some troubles using Tree getFilteredTree() method, it returns null even if there are records that should match the AdvancedCriteria.
    More specifically, I modified the following SmartClient example, Trees -> DataBinding -> Parent linking using following snippet
    Code:
    var advancedCriteria = {
            _constructor:"AdvancedCriteria",
            criteria:[
                {fieldName:"Code", operator:"iStartsWith", value:"1.1"}
            ]
        }
    
    
    isc.TreeGrid.create({
        ID: "employeeTree",
        data: isc.Tree.create({
            modelType: "parent",
            nameProperty: "Name",
            idField: "EmployeeId",
            parentIdField: "ReportsTo",
            data: [
                {EmployeeId:"4", ReportsTo:"1", Name:"Charles Madigen", Code:"1"},
                {EmployeeId:"188", ReportsTo:"4", Name:"Rogine Leger", Code:"1.1"},
                {EmployeeId:"189", ReportsTo:"4", Name:"Gene Porter", Code:"1.2"},
                {EmployeeId:"265", ReportsTo:"189", Name:"Olivier Doucet", Code:"1.1.1"},
                {EmployeeId:"264", ReportsTo:"189", Name:"Cheryl Pearson", Code:"1.3"}
            ]
        }).getFilteredTree(advancedCriteria),
    
        // customize appearance
        width: 500,
        height: 400,
        nodeIcon:"icons/16/person.png",
        folderIcon:"icons/16/person.png",
        showOpenIcons:false,
        showDropIcons:false,
        closedIconSuffix:""
    });
    Gui claims that there is not any node to show.
    I tried to use "startsWith" operator, obtaining the same result, and I put a simple criteria too, {Code:'1.1'}, but no nodes were returned.
    I can't understand what is missing or where my fault lies.
    I made a test with smartgwt too, 5.1d 2014-10-08 build, obtaining the same result, but if I invoke the findAll method, using the same AdvancedCriteria, I get the expected records.
    I attached the simple main class I used for the test

    Thanks in advance
    Attached Files

    #2
    Your criteria eliminates the root node, so there is nowhere to display the remaining nodes. You would need to either change the rootValue or the reportsTo property value to fix this.

    Comment

    Working...
    X