Announcement

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

    TreeGrid ClientOnly Local Datasource Filtering

    Support,

    Using your website Feature Explorer, Safari Version 9.0.1 (11601.2.7.2).

    I'm having trouble getting TreeGrid to filter correctly. Paste the code below into the feature explorer and please notice that it *almost* works.

    To test:
    1. click the load button because I'll need to load the data *after* initialization. Further, I'll load different data during the life of the TreeGrid.
    2. enter filter text and notice that nodes are not pruned correctly. Some nodes do, but others don't.
    3. Also notice that I can't get openAll to work correctly on first fetchData()

    Here is the code:

    var myData = [
    { EmployeeId:"4", ReportsTo:"1", Name:"Charles Madigen" },
    { EmployeeId:"188", ReportsTo:"4", Name:"Rogine Leger" },
    { EmployeeId:"189", ReportsTo:"4", Name:"Gene Porter" },
    { EmployeeId:"265", ReportsTo:"189", Name:"Olivier Doucet" },
    { EmployeeId:"264", ReportsTo:"189", Name:"Cheryl Pearson" }
    ];

    isc.setAutoDraw( false );

    isc.VLayout.create({
    autoDraw:true, width:"100%", height:"100%",
    members:[

    isc.Button.create({
    title: "Load",
    click: function() {
    MyTree.dataSource.setCacheData( myData );
    MyTree.fetchData();
    }
    }),

    isc.TreeGrid.create({

    ID: "MyTree",
    initWidget: function(arguments) {
    this.Super( "initWidget", arguments);
    this.dataSource = isc.DataSource.create( {
    clientOnly: true,
    keepParentsOnFilter: true,
    fields: [
    { name: "Name" },
    { name: "EmployeeId", primaryKey:true },
    { name: "ReportsTo", foreignKey:"EmployeeId" }
    ]
    });
    },

    autoFetchData: false,
    dataFetchMode: "local",
    loadDataOnDemand: false,

    dataProperties:{
    dataArrived:function (parentNode) {
    this.openAll();
    }
    },

    showFilterEditor: true,
    filterOnKeypress: true,
    filterLocalData: true,

    fields: [
    { name: "Name", canFilter:true }
    ]

    })
    ]
    });

    Thanks in advance, and all the best.
    Mitch
    Registered, and support is being renewed now. Invoice in hand.

    #2
    Could you give an example of a specific filter string you are typing in, and a specific node that you expected to be present or not present, where things didn't happen as expected?

    The problem with just running the test case is that we may not be able to figure out what you think is wrong.

    Comment


      #3
      Thanks for the response.

      The test will show a tree of people's names.

      Because the filter editor is on, you can type letters of someone's name, and you'll be able to see that it isn't working.

      Type R for Rogene and no items remain.

      Comment


        #4
        Rogene won't be shown because it's parent, Charles Madigen, is eliminated by the "R" filter.

        It looks like you intended to set keepParentsOnFilter to avoid this, but, you've set it on the DataSource - it's actually a property of ResultTree, so it should be in your dataProperties block.

        Comment


          #5
          Awesome. That worked :-)

          Thank you. Btw, the documentation does show the property (additionally) on TreeGrid directly. Is this a mistake? TreeGrid.keepParentsOnFilter [IR]

          Comment


            #6
            Yes, you're correct, it can be set directly on TreeGrid (as of a couple of versions ago). It's just DataSource where it's not a recognized property.

            Comment


              #7
              Ah, my mistake. I see now that I defined it on the datasource and not the tree. Argh. Thank you :-)

              Comment

              Working...
              X