Results 1 to 4 of 4

Thread: [1.1] TreeStore & BeanModel - How???

  1. #1

    Question [1.1] TreeStore & BeanModel - How???

    I'm trying to use the new BeanModel feature (http://extjs.com/blog/2008/07/14/pre...-with-ext-gwt/) with my Tree, but failing badly.

    Each class in my POJO object graph has an equivilent @BEAN model class, and certain non-leaf POJO's contain Lists of child objects. My question is how can TreeStore & TreeBinder be used to read & understand my POJO graph. I'm doing the following:

    Code:
            
    BeanModelFactory factory = BeanModelLookup.get().getFactory(
    FormDefinition.class);
    BeanModel model = factory.createModel(definition);
    
    Tree tree = new Tree();
    TreeStore treeStore = null;
    treeStore = new TreeStore();
    treeStore.setMonitorChanges(true);
    treeStore.setModelComparer(new DefaultModelComparer<BeanModel>());
            
    treeStore.add(model, true);
    
    TreeBinder<BeanModel> treeBinder = new TreeBinder<BeanModel>(tree,treeStore);
    treeBinder.setDisplayProperty("label");
    treeBinder.init();
    and the 'add' does add a root to the tree, but the children don't get added - obviously because the store or binder doesn't understand my POJO graph or how to access the children.

    Help, anyone!

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572

    Default

    how are you loading the store? where is your TreeLoader?

    Have a look at the AsyncTreeExample in Samples\Examples

  3. #3

    Default

    I'm just calling treeStore.add() to populate my store - why do I have to use a loader - or if I do, then what does it give me that helps load a nest BeanModel? In the sample you mentioned, then FileModel extends BaseModelData rather than being a POJO, and as such doesn't use BeanModel.

  4. #4
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572

    Default

    Quote Originally Posted by danny.robinson View Post
    I'm just calling treeStore.add() to populate my store - why do I have to use a loader
    you don't, but then you're responsible for ensuring you nest the beans correctly. without a full and complete example I can't really say what is going wrong. I pointed you to the example as it shows a working tree that loads via a store etc...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •