PDA

View Full Version : Sorting a nested list problem



profunctional
10 Jul 2010, 7:04 AM
I have a nested list populated with a store using the code below:

ticketListStore.loadData(obj.Rows);

I then sort the store using this

ticketListStore.sort(orderBy , orderDir);

The first time it loads up, the list is sorted correctly.

When i try to call

ticketListStore.sort(orderBy , orderDir); again with a different orderBy, the list is still sorted using the old orderBy.

Am I missing something?

Thanks!

evant
11 Jul 2010, 3:13 PM
Are you talking about the NestedList class, or are you using 2 Lists? Because the NestedList isn't backed by a store.

profunctional
13 Jul 2010, 8:28 AM
I am using an array that populates the list. The ticketStore is already sorted by the time i execute the below code.

tickets = Array();

for (var i = 0; i < ticketListStore.getCount(); i++) {
ticket = ticketListStore.getAt(i);
priority = ticket.priority;
priorityname = '';
if (priority == '4')
priorityname = 'critical'
if (priority == '3')
priorityname = 'high'
if (priority == '2')
priorityname = 'medium'
if (priority == '1')
priorityname = 'low'

tickets.push(
{
text: '<div><span class="customername">' + ticket.CustomerName + '</span><span class="right-line">'+ ticket.creationDate +'</span></div><div class="longtext">'+ ticket.subject +'</div><div><span class="' + priorityname + '">' + ticket.priority + '</span><span class="status">' + ticket.TicketStatus + '</span></div>',
cls: 'arrow',
handler: function (){
alert('testing');
}
}
);
}
var newItem = {
title: 'title',
items: [tickets]
}

ticketList.setList(tickets, true);