1. #1
    Ext User
    Join Date
    Jun 2010
    Posts
    2
    Vote Rating
    0
    Alexander.K is on a distinguished road

      0  

    Default add new items to nestedlist

    add new items to nestedlist


    hey sencha community
    i am new in this board and i need a little bit help as first.
    i create a little application with the new sencha framework and i have problems with the nestedlist, i cant add new items:

    Code:
    for(i=0;i<responseObj.lists.length;i++){
      var rowData = responseObj.lists[i];
      var newItem = nestedList.add({text:rowData.name});
      nestedList.doLayout();
    }
    we have test it with add, render, doLayout etc.
    what i do wrong? thanks for help and sorry for my bad english

  2. #2
    Ext User
    Join Date
    Jun 2010
    Posts
    18
    Vote Rating
    0
    Simonhayre is on a distinguished road

      0  

    Default


    Give something like this a go
    PHP Code:
                                      var newObject = Array();
                        for (var 
    0responseObj.lengthi++) {
                    
                            
    newObject.push(
                                {
                                    
    name responseObj[i]['col1'],
                                    
    id:responseObj[i]['col2'],
                                    
    labelresponseObj[i]['col3'],
                                    
    valueresponseObj[i]['col4'],
                                    
    listenersonChangeValue
                                
    }    
                            );                            
                        }

    ----------------------------------------------------------------------------------------
                                   var 
    newItem = {
                        
    titletitle,
                        
    items: [newObject]
                                         } 
    once you have created your object you then have to create a nestedlist object
    PHP Code:
    var nestedList = new Ext.NestedList({
                
    fullscreentrue,        
            
    items: []
            }); 
    And then set the list.
    PHP Code:
    nestedList.setList(newItemtrue); 

  3. #3
    Ext User
    Join Date
    Jun 2010
    Posts
    2
    Vote Rating
    0
    Alexander.K is on a distinguished road

      0  

    Default


    thanks for the fast help

  4. #4
    Ext User
    Join Date
    Jul 2010
    Posts
    27
    Vote Rating
    1
    robando is on a distinguished road

      0  

    Default


    is this an undocumented method? Also, is this meant to add multiple items at one time? I have only been able to add a single item and it replaces the list that is currently there. I've been trying to update the list by doing the following

    Code:
    	var newItem = {
    			baseCls: 'order-blotter-item',
    			html: '<div class="order-blotter-item-content"><div id="sell_arrow"></div><div class="order-blotter-item-side">Sell</div><div class="order-blotter-item-details"><span class="amount">1000</span> shares of <span class="symbol">IBM</span> at Market at <span class="price">132</span></div><div class="order-blotter-item-status pending">Pending Approval</div></div>',
    			handler: views.showOverlay
    		};
    	views.orderBlotterItems.add(newItem);
    	views.orderBlotterItems.doLayout();
    but the interface does not repaint the new items. Can anybody help me out with this?

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,055
    Vote Rating
    659
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    The nested list is changing fairly significantly for the next release, where it will be backed by a hierarchical store, so a lot of this discussion is fairly irrelevant.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Similar Threads

  1. TabPanel (w/ TabBar) and NestedList as Content
    By sjh in forum Sencha Touch 1.x: Discussion
    Replies: 24
    Last Post: 13 Jul 2010, 1:18 PM
  2. Is it possible to use different components as parts of a NestedList?
    By irene in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 24 Jun 2010, 11:03 AM
  3. Remove Some items from toolbar and add New Items Not Working
    By shajeerkt in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 15 Feb 2010, 6:28 AM
  4. Extending Window with items gives this.items.add is not fcn
    By serff in forum Ext 2.x: Help & Discussion
    Replies: 17
    Last Post: 8 Feb 2010, 5:03 AM
  5. Panel.items.add - but no new items showing
    By fredrikmh in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 16 Sep 2008, 5:54 AM

Thread Participants: 3