Results 1 to 3 of 3

Thread: Need BeanModel to appear multiple times in the same TreePanel

  1. #1

    Question Need BeanModel to appear multiple times in the same TreePanel

    I have a TreePanel I'm loading with BeanModels, using a TreeStore, BaseTreeLoader, and TreeModelReader (but no proxy). Each bean has a unique ID in a field called "id". I need the same bean to show up multiple times in the tree, under different parents. I am not using a key provider.

    Currently, only the first row containing the node is rendered. The second place the node should appear is a blank row. Looking at the div, both have the same ID, but the first one contains the icons and text for the node. The second one contains nothing.

    When not using a key provider, it appears that each TreeModel that wraps the BeanModel gets a unique id (String.valueOf(counter++)). However, the div id appears to be derived from my bean's id field, not the wrapped, unique id. Is this expected? Is the fact that my bean has a field "id" (and an accessor getId()) interfering with the model somehow?

    Any help on how to allow the same bean to appear multiple times in the same TreePanel would be much appreciated.

    Thanks!

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    The problem is that the same beanmodel can only have one parent at a given time. You can only add the same instance one time to the treestore.

    You need to change your logic, that also the beans have the same UI to the outside, they need to be different on the clientside.

    To solve this, you would have two beans with the same displayValue for example. So they look the same, but are logical different.

  3. #3

    Default

    Ok, I see the problem. I thought I was getting uniqueness based on the wrapper id, but the model maps my bean, which uses the ID field for equality, hence the collision.

    Thanks for the quick response Sven!

Similar Threads

  1. Why is layout done multiple times?
    By Jazor in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 1 Aug 2009, 6:43 AM
  2. Reuse a gridpanel multiple times
    By Peeer in forum Ext 2.x: Help & Discussion
    Replies: 16
    Last Post: 3 May 2009, 5:12 AM
  3. Help: How to Display the same panel multiple times
    By g_papasavva in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 29 Jul 2008, 10:48 PM
  4. one variable... needs to be called multiple times
    By Guteman in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 13 Nov 2007, 11:59 AM

Tags for this Thread

Posting Permissions

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