Forum


I'm struggling to make the client-side date sorting work. I'm using 3.7.2 (I heard that this version corrected a prior problem with client-side date sorting).
When I run the code below, the data displays correctly, and non-date columns sort correctly. Even the date column SEEMS to sort correctly, but when you look closely about 10 - 20% of the records are out of order.
I've tried various permutations of different configuration options--the simplest version is pasted below.
Any ideas?
<script type="text/javascript">
jQuery("#list3").jqGrid({
url:'/ajax.asp',
datatype: "xml",
colNames:['IDField','TextField','DateField'],
colModel:[
{name:'IDField',index:'IDField', hidden:true},
{name:'TextField',index:'TextField', width:120, sorttype:"text"},
{name:'DateField',index:'DateField', width:80, sorttype:"date"}
],
rowNum:-1,
rowList:[10,20,30],
pager: '#pager3',
viewrecords: true,
loadonce: true,
height: 300
});
</script>
Here's a snippet of the XML that the server is sending to the browser:
<?xml version="1.0" encoding="utf-8" ?>
<rows>
<page>1</page>
<total>1</total>
<records>10</records>
<row id="114584-1">
<cell>114584-1</cell>
<cell>MAGGIE</cell>
<cell>6/10/2010</cell>
</row>
<row id="115837-1">
<cell>115837-1</cell>
<cell>CANDI</cell>
<cell>2/23/2010</cell>
</row>
<row id="117156-2">
<cell>117156-2</cell>
<cell>ACE</cell>
<cell>5/17/2010</cell>
</row>
<row id="117376-1">
<cell>117376-1</cell>
<cell>JESSE</cell>
<cell>7/6/2010</cell>
</row>
<row id="118718-1">
<cell>118718-1</cell>
<cell>SADIE</cell>
<cell>6/7/2010</cell>
</row>
<row id="119029-1">
<cell>119029-1</cell>
<cell>RUSTY</cell>
<cell>5/22/2010</cell>
</row>
<row id="120458-1">
<cell>120458-1</cell>
<cell>BUCK</cell>
<cell>6/2/2010</cell>
</row>
<row id="123220-1">
<cell>123220-1</cell>
<cell>KOHLE</cell>
<cell>5/23/2010</cell>
</row>
<row id="123724-1">
<cell>123724-1</cell>
<cell>SASSY</cell>
<cell>4/23/2010</cell>
</row>
<row id="125335-2">
<cell>125335-2</cell>
<cell>SHEEBA</cell>
<cell>7/6/2010</cell>
</row>
</rows>
02:35

10/08/2009

You should include datefmt:"m/d/Y" in the column model which corresponds your date format. Corresponds to the documentation default value is the ISO Date (Y-m-d). Moreover I don't recomend you to use a large int value instead like rowNum:10000.
Best regards
Oleg
Most Users Ever Online: 715
Currently Online:
68 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66