PDA

View Full Version : Data Grid Sort Question



cpryce
1 Jun 2007, 5:58 AM
I have a data grid read from markup. The data set is defined as :


var myData =
[
['<a href="/">An Event ...</a>', 'Something', 'Planned', 'WE 08/11/07, 4 weeks','$10,001'],
['CP-Test Walkthrough', 'This is an Edited Description', 'Pending', 'WE 07/21/07, 4 weeks', '$5,000'],
['STA Test Event Edited', 'This is the event description. This is edited twice', 'Pending', 'WE 07/21/07, 4 weeks', '$200,000'],
['CP Test Event 2', 'This is an executed event', 'Executed', 'WE 06/15/06, 2 weeks','$10,000'],
['STA 3','','Pending','WE 07/07/07, 2 weeks', '$0'],
['<a href="http://foo.com">STA9</a>','','Pending','WE 07/07/07, 2 weeks', '$0' ],
['May Madeness','','Pending','WE 07/07/07, 2 weeks', '$0'],
['Event 1', '','Pending','WE 07/07/07, 2 weeks', '$0']
];

I load this data for my data grid with the following:


var ds = new Ext.data.Store(
{
proxy: new Ext.data.MemoryProxy(myData),
reader: new Ext.data.ArrayReader({},
[
{name: 'event', sortType: 'asText'},
{name: 'description'},
{name: 'status'},
{name: 'execution'},
{name: 'budget'}
])
});
ds.load();
ds.sort('event');

I had thought from reading the docs and searching the forum that sortType: 'asText' would strip the HTML and sort the columns on what was inside, but this is not the behavior that I am seeing. The two rows with the A tags are sorting first.

What am I missing?

tryanDLS
1 Jun 2007, 8:19 AM
Off the top of my head, that looks right. Did you try stepping thru store.applysort() to see what it's comparing?

cpryce
1 Jun 2007, 8:33 AM
Off the top of my head, that looks right. Did you try stepping thru store.applysort() to see what it's comparing?

Not yet. I'll have to include the debug version and try that. Thanks for helping me narrow down the places to search.