1. #1
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    Pilsen, Czech Republic
    Posts
    40
    Vote Rating
    0
    dherbolt is an unknown quantity at this point

      1  

    Post Unanswered: Tree: Add node sorted

    Unanswered: Tree: Add node sorted


    Hi all,
    Is there any way how to add node into tree with applied sort? I have defined Ext.data.TreeStore with sorter, but it is applied only when data are loaded.
    If I add node into tree by parentNode.appendChild(node), the node is added as last child of parent (I know, it's append). But how I can add node according to current sort state?
    I'm looking for something like Ext.data.Store.addSorted.

    Thanx for advice.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,797
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What framework and version?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    Pilsen, Czech Republic
    Posts
    40
    Vote Rating
    0
    dherbolt is an unknown quantity at this point

      0  

    Default


    Sorry, I forgot mention it.

    ExtJS 4.1.1.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,797
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Quote Originally Posted by dherbolt View Post
    Sorry, I forgot mention it.

    ExtJS 4.1.1.
    Moved to Ext JS 4 forum
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    Pilsen, Czech Republic
    Posts
    40
    Vote Rating
    0
    dherbolt is an unknown quantity at this point

      -1  

    Default


    Quote Originally Posted by dherbolt View Post
    Hi all,
    Is there any way how to add node into tree with applied sort? I have defined Ext.data.TreeStore with sorter, but it is applied only when data are loaded.
    If I add node into tree by parentNode.appendChild(node), the node is added as last child of parent (I know, it's append). But how I can add node according to current sort state?
    I'm looking for something like Ext.data.Store.addSorted.

    Thanks for advice.
    In ExtJS 3, TreeNode.appendChild adds new node to proper position according to current sort state if Ext.tree.TreeSorter is defined for the Tree.

  6. #6
    Sencha - Community Support Team friend's Avatar
    Join Date
    Apr 2011
    Posts
    895
    Answers
    106
    Vote Rating
    27
    friend has a spectacular aura about friend has a spectacular aura about

      0  

    Default


    If all else fails, you always manually call the sort method of Ext.data.TreeStore, after adding your new node.

  7. #7
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    Pilsen, Czech Republic
    Posts
    40
    Vote Rating
    0
    dherbolt is an unknown quantity at this point

      0  

    Default


    Quote Originally Posted by friend View Post
    If all else fails, you always manually call the sort method of Ext.data.TreeStore, after adding your new node.
    Yes, I know. But I don't want to sort whole store I added only one node. It is enough to sort only items of parent node.

  8. #8
    Sencha Premium Member
    Join Date
    Aug 2007
    Location
    Pilsen, Czech Republic
    Posts
    40
    Vote Rating
    0
    dherbolt is an unknown quantity at this point

      0  

    Default


    Yes, it works, but only when I use:
    Code:
    Ext.getCmp('treepanel-1009').getRootNode().appendChild({text: '0a'});
    Ext.getCmp('treepanel-1009').getStore().sort(this.generateComparator());
    It is "user unfrendly" because I have to call sort manually after append.

    If I use store's "append" event:
    Code:
    var store = Ext.getCmp('treepanel-1009').getStore();
    store.on('append', function () {this.sort(this.generateComparator())}, store);
    I get TypeError exception:
    Code:
    TypeError: sibling is undefined
    http://localhost/extjs_4.1.1/ext-all-dev.js
    Line 77912
    Tested on xml tree example from ExtJS 4.1.1 package.

Thread Participants: 2

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi