1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    27
    Answers
    2
    Vote Rating
    1
    English is on a distinguished road

      0  

    Default Unanswered: Set getItemTextTpl in Nested List from Controller?

    Unanswered: Set getItemTextTpl in Nested List from Controller?


    I have a nested list in my MVC application. Part of the template (getItemTextTpl) needs to be translated according to the current language.
    This requires dynamically changing (or over-riding) the getItemTextTpl function.

    I have tried all ways to do this - both in the view, and in the controller, but it just doesn't change.

    Is this possible? How would it be achieved?

    My latest attempt is this (in the controller):
    Code:
    controller.getCurriculaList().getItemTextTpl=function(node){
       return '<div>...</div>';
    };
    Although this does alter the template, it's not getting the (node) parameter, so I can't do conditional formatting.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    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


    I assume a list has already been shown in the NestedList, in that case you would have to set the itemTpl on the child lists that were already created. setItemTpl actually had a bug in ST 2.1.0 that will be fixed in 2.1.1
    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 User
    Join Date
    Dec 2011
    Posts
    1
    Vote Rating
    0
    aminodrago is on a distinguished road

      0  

    Default set the getItemTextTpl in Nestedlist every Tree store level

    set the getItemTextTpl in Nestedlist every Tree store level


    ( my English is not goooood but it is OK ) please i have may be the same problem , i can't set the getItemTextTpl in my Nestedlist
    but i did like that
    Code:
    ,
                        getItemTextTpl : function(node){                    
                            if(node.data.level!=0){        
                
                            return "<img src='{logo}' width='40' height='40' class='thumb'/><div style='font-size:12px;'><div style='font-size:11px;'>{name}</div> <div  class='date'></div></div>";
    
                            }else if(node.data.level==1){
                          
                                return "<img src='{min_photo}' width='100' height='70' class='thumb'/><div style='font-size:12px;'><div style='font-size:11px;'>{name}</div> <div style='font-size:11px;'>{prixrang}</div><div  class='date'></div></div>";
                            }                
                        }
    it work only because in the first level the "node" is detected but on tap first level item
    node is undefined

    but i want to change the
    Tpl in level 3 so .... how can i do it , i try my best but
    please help


    Code:
    ,
    getItemTextTpl : function(node){                    
                            if(node.data.level!=0){                    
                            return "<img src='{logo}' width='40' height='40' class='thumb'/><div style='font-size:12px;'><div style='font-size:11px;'>{name}</div> <div  class='date'></div></div>";
                            }else if(node.data.level==1){
                            
                                return "<img src='{min_photo}' width='100' height='70' class='thumb'/><div style='font-size:12px;'><div style='font-size:11px;'>{name}</div> <div style='font-size:11px;'>{prixrang}</div><div  class='date'></div></div>";
                            }else if(node.data.level==2){
                            
                            return "<img src='{min_photo}' width='100' height='70' class='thumb'/><div style='font-size:12px;'><div style='font-size:11px;'>{name}</div> <div style='font-size:11px;'>{prix}</div><div  class='date'></div></div>";
                            }                
                        }