View Full Version : add new items to nestedlist
Alexander.K
30 Jun 2010, 3:15 AM
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:
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 :D
Simonhayre
30 Jun 2010, 5:07 AM
Give something like this a go
var newObject = Array();
for (var i = 0; i < responseObj.length; i++) {
newObject.push(
{
name : responseObj[i]['col1'],
id:responseObj[i]['col2'],
label: responseObj[i]['col3'],
value: responseObj[i]['col4'],
listeners: onChangeValue
}
);
}
----------------------------------------------------------------------------------------
var newItem = {
title: title,
items: [newObject]
}
once you have created your object you then have to create a nestedlist object
var nestedList = new Ext.NestedList({
fullscreen: true,
items: []
});
And then set the list.
nestedList.setList(newItem, true);
Alexander.K
30 Jun 2010, 5:46 AM
thanks for the fast help :)
robando
7 Sep 2010, 1:19 PM
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
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?
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.
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.