PDA

View Full Version : Edit List items



ssdesign
5 Aug 2010, 7:55 PM
Hi,
Is it possible to have 'Edit' button which can allow editing (removing) items from a list? (like the native List conponent in XCode.

Any pointers on how to achieve this?

I was thinking of using some kind of DOM manipulation to add DIV elements to list component and performing some actions but not sure if anyone has already done it.

blessan
6 Aug 2010, 1:28 AM
{
xtype: 'list',
store: giftStore,
tpl: '<tpl for="."><div class="gifts {cls}">'+
'<span class="listDelete deleteGifts">&nbsp;</span>'+
'<span class="listProduct listPayType">{giftNumber}</span>'+
'<span class="listDelete listPayAmount">{price}</span>'+
'</div></tpl>',
itemSelector: 'div.gifts',
singleSelect: true,
cls:'productList',
scroll:false,
listeners: {
"itemtap": function(dataview,index,element,evt) {
eventClassname = evt.target.className;
titleClassname = element.className;
if((eventClassname.search('deleteGifts')!= -1) &&(titleClassname.search('prodListHeader') == -1)) {
selectedRecord = dataview.store.getAt(index);
dataview.store.remove(selectedRecord);
}
}
}
}


This is how I got it done to remove rows from a list. I added a class call deletegifts to the delete button. So when the itemtap event occurs I can know where the user clicked. Well I guess the code will explain everything for u.

ssdesign
6 Aug 2010, 3:48 AM
cool, sounds interesting.
I am going to try it later today.

Considerate
6 Aug 2010, 6:48 PM
...