Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
client-side date sorting is not working
26/08/2010
22:22
Avatar
Octavient
Member
Members
Forum Posts: 9
Member Since:
26/08/2010
sp_UserOfflineSmall Offline

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>

26/08/2010
23:16
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Without having test data which are wrong sorted it's impossible to help you. Just save XML data returned from '/ajax.asp' and include the data in your post.

27/08/2010
00:14
Avatar
Octavient
Member
Members
Forum Posts: 9
Member Since:
26/08/2010
sp_UserOfflineSmall Offline

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>

27/08/2010
02:35
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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

27/08/2010
04:21
Avatar
Octavient
Member
Members
Forum Posts: 9
Member Since:
26/08/2010
sp_UserOfflineSmall Offline

Thank you--that worked.

Sorry--I'd tried datefmt:"mm/dd/yyyy" but that hadn't worked. 

Thanks for the replies.  Great product, too. 

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information