Announcement

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

    TreeGrid - Tree.getData() is always empty

    I'm working with lazy loaded TreeGrid (loadDataOnDemand=true) and I try to select a specific node after data are fetched.
    The problem is that when I access the Tree from TreeGrid, it does not contain any data.

    For example, I've modified LoadOnDemandTreeSample.java from the SmartGWT Showcase to display the length of the data :
    http://www.smartclient.com/smartgwt/showcase/#tree_databinding_ondemand

    Code:
    employeeTreeGrid.addDataArrivedHandler(new DataArrivedHandler() {
      public void onDataArrived(DataArrivedEvent event) {
        SC.logWarn("onDataArrived: " + employeeTreeGrid.getData().getData().length);
      }
    });
    employeeTreeGrid.addDrawHandler(new DrawHandler() {
      public void onDraw(DrawEvent event) {
        SC.logWarn("onDraw: " + employeeTreeGrid.getData().getData().length);
      }
    });
    It always return 0.

    If employeeTreeGrid.getData() does not contain any record, I'm not able to use method like Tree.find(String fieldNameOrPath).

    Any ideas of what I'm doing wrong ?
    Maybe there is another approach to select a node once the tree is drawn?

    Thanks for your help.

    Cedric

    #2
    I must be misunderstanding something because in my code Tree.findById(String id) returns me the right node even if Tree.getData() is empty...

    But Tree.find(String fieldNameOrPath) does not return anything.
    Even in the showcase exemple, it does not find anything:
    Code:
    employeeTreeGrid.addDrawHandler(new DrawHandler() {
      public void onDraw(DrawEvent event) {
        SC.logWarn("onDraw: " + employeeTreeGrid.getData().getData().length); // lenght == 0
        TreeNode node = tree.find("Charles Madigen");
        SC.logWarn("node: " + node); // node is null
      }
    });
    Any ideas ?

    Comment


      #3
      What version of Smart GWT are you using? Always mention this.

      Comment


        #4
        I use SmartGWT 1.3 and GWT 1.7.1.

        And I did my tests with LoadOnDemandTreeSample.java from the Showcase shipped with SmartGWT 1.3

        Comment

        Working...
        X