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_Related Related Topics sp_TopicIcon
Trying to sort a date column - jqGrid.min.js throws an exception...
20/10/2010
18:50
Avatar
simspace
Member
Members
Forum Posts: 12
Member Since:
01/09/2010
sp_UserOfflineSmall Offline

Hi,

I am trying to sort my grid on a date column. No matter what I do the dates never sorts correctly.

The dates are coming back from the server as a string formatted as mm/dd/yyyy with leading zero suppression. So it will look like 10/10/2010 or 9/9/2010.

In the docs I found out that I should use the sorttype property. But, whenever I add sorttype:'date' to the date column in my ColModel, jqGrid throws the following exception…

      jquery.jqGrid.min.js:17   Uncaught TypeError: Object 1506747600000 has no method 'toLowerCase'

I am using jqGrid 3.8. 

Would someone please provide me any advise or examples showing how to sort a grid with date columns?

My code is below…

Thank You!

Chris

$j(document).ready(function() {

   leadGrid = $j("#leadlist").jqGrid({

      colNames:['Id', 'Lead Date', 'First Name', 'Last Name', 'Status', 'Quality', 'Description'],

      colModel :[

      {name:'ID', index:'ID', key:true, formatter:'integer', sorttype:'int', width:55, sortable:false, hidden:true, search:false},

      {name:'DATE_CREATED', index:'DATE_CREATED', width:50, align:'center', sorttype:'date', formatter:'date', formatoptions:{srcformat: 'm-d-Y', newformat:'ShortDate'}, search:false},

      {name:'FIRST_NAME', index:'FIRST_NAME', width:50},

      {name:'LAST_NAME', index:'LAST_NAME', width:50},

      {name:'STATUS', index:'STATUS', width:50, align:'center', search:true, stype:'select', surl:'/hub/get-lead-status-list', searchoptions:{buildSelect:getList} },

      {name:'QUALITY', index:'QUALITY', width:50, align:'center', search:true, stype:'select', surl:'/hub/get-lead-quality-list', searchoptions:{buildSelect:getList} },

      {name:'DESC', index:'DESC', width:150}

   ],

   ondblClickRow: function(rowid, rowndx, colndx, objEvent)

   {

      top.location.href = '/hub/get-lead/id/'+rowid;

   },

   caption: 'Leads',

   pager: '#leadpager',

   datatype: 'local',

   sortname: 'DATE_CREATED',

   sortorder: 'desc',

   rowNum:20,

   rowList:[20,50,100],

   width:750,

   height:465,

   hidegrid:false,

   altRows:true,

   loadonce:true,

   viewrecords: true,

   ignoreCase:true

});


Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
33 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