1. #1
    Sencha User
    Join Date
    Nov 2008
    Posts
    92
    Vote Rating
    1
    diablo is on a distinguished road

      0  

    Default Tree node css class

    Tree node css class


    I want to change the css class of a tree node after a certain action has been performed. In API i have not found something to resolve this. I have made a custom setter function when i am building each node of the tree with Ext.tree.AsyncTreeNode but it seems it has no effect.

    Any hint is valuable.

    Thanks in advance!

  2. #2
    Sencha User
    Join Date
    Nov 2008
    Posts
    92
    Vote Rating
    1
    diablo is on a distinguished road

      0  

    Default


    Quote Originally Posted by diablo View Post
    I want to change the css class of a tree node after a certain action has been performed. In API i have not found something to resolve this. I have made a custom setter function when i am building each node of the tree with Ext.tree.AsyncTreeNode but it seems it has no effect.

    Any hint is valuable.

    Thanks in advance!
    I have found a possibility accessing the treeNodeUI has the methods that i need addClass(), removeClass(). hopefully will help.

    thx

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    95
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Here is an example that changes the tree node icon.

    You can adapt it to change the tree node cls itself.

  4. #4
    Sencha User
    Join Date
    Nov 2008
    Posts
    92
    Vote Rating
    1
    diablo is on a distinguished road

      0  

    Default


    @Condor - thank you for your suggestion! it worked with removeClass() followed by add new Class().

    i would appreciate a hint for same kind of action but in a Grid. I have a grid row selected and after a certain action is executed to change the selected row icon that is shown in a grid column. I have managed to change the typeIcon inside, but i cannot refresh/commit the row. I have tried several ways : grid.doReload(), store.data.clear(), selectedRow.commit(), store.commitChanges() etc. but neither of this seems to update the icon with the new one...

    thx!

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    95
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    I assume your column renderer displays an icon based on the value of some field?

    In that case you only need to change the field, e.g.
    Code:
    var record = store.getAt(rowIndex);
    record.set('myfield', newValue);

  6. #6
    Sencha User
    Join Date
    Nov 2008
    Posts
    92
    Vote Rating
    1
    diablo is on a distinguished road

      0  

    Default


    Thank you Condor! You rock!

    It works now! Thx!

Thread Participants: 1