Sigma Php Ajax framework, Ajax Components, GUI Builder
May 21, 2012, 09:16:40 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Sigma Php Ajax framework, Ajax Components, GUI Builder
>
Sigma Grid
>
Sigma Grid - Q&A
(Moderators:
steven
,
gbolanoscruz
) >
Sigma Grid Soring Issue for Date column
Pages: [
1
]
« previous
next »
Print
Author
Topic: Sigma Grid Soring Issue for Date column (Read 1220 times)
Gowtham
Jr. Member
Posts: 11
Sigma Grid Soring Issue for Date column
«
on:
September 10, 2009, 02:28:55 AM »
While sorting the date column in sigma grid, not sorted based on date. It is sorted like string column.
kindly suggest.
Logged
steven
Moderator
Hero Member
Posts: 544
Re: Sigma Grid Soring Issue for Date column
«
Reply #1 on:
September 10, 2009, 02:31:50 AM »
Do a customized sorting. just like
http://www.sigmawidgets.com/products/sigma_grid2/demos/example_customized_sort.html
Logged
Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
Gowtham
Jr. Member
Posts: 11
Re: Sigma Grid Soring Issue for Date column
«
Reply #2 on:
September 10, 2009, 03:13:29 AM »
In this sample, The Score column is not sorting based on score values. please reply.
Logged
steven
Moderator
Hero Member
Posts: 544
Re: Sigma Grid Soring Issue for Date column
«
Reply #3 on:
September 10, 2009, 05:25:35 PM »
Yes, teams which lose more appears before teams lose less. The following code just show you a way to implement your sorting rules.
{id: 'score' , header: "Score" , width :80, sortFn :function(r1,r2){ arr1 = r1[1].split(":"); arr2 = r2[1].split(":"); return (arr1[0]-arr1[1]) - (arr2[0]-arr2[1]); } },
suppose you have a date with "MM/DD/YYYY" as formate. The code should go like
{id: 'date' , header: "Score" , width :80, sortFn :function(r1,r2){ arr1 = r1["date_col"].split("/"); arr2 = r2["date_col"].split("/"); //compare year first if(arr1[2]>arr2[2]) return 1; if(arr1[2]<arr2[2]) return -1; //compare month if(arr1[1]>arr2[1]) return 1; if(arr1[1]<arr2[1]) return -1; //compare date return arr1[1]-arr2[1]; } },
«
Last Edit: September 10, 2009, 05:33:37 PM by steven
»
Logged
Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
Gowtham
Jr. Member
Posts: 11
Re: Sigma Grid Soring Issue for Date column
«
Reply #4 on:
September 10, 2009, 09:04:27 PM »
Thank you steven
Logged
eWineGuy
Newbie
Posts: 1
Re: Sigma Grid Soring Issue for Date column
«
Reply #5 on:
January 19, 2010, 02:10:06 PM »
Perhaps I'm the only one having date sort troubles using your solution, but perhaps others are as well. When I implement what you suggest, my grid dies and never displays. Maybe I have a variable naming issue so perhaps a bit more explanation would be helpful.
For the ID named "date", you reference "date_col" in your custom sort script. Is this a reserved word? I have an ID field named OrderDate. Do I use (1) "date_col" (2) "OrderDate_col" or (3) something else?
I assume the data set Option data type is set to date ... {name : 'OrderDate' ,type: 'date' },
I even changed to use the ID of "date" as per your example and still my grid dies. I remove the custom sort and it's fine.
Comments or assistance welcome!
(newbie)
Logged
dwlovell
Jr. Member
Posts: 15
Re: Sigma Grid Soring Issue for Date column
«
Reply #6 on:
January 25, 2010, 08:01:54 AM »
I think an easier solution is to just set the column type as int, then use the getSortValue() method overload on the column that uses new Date(thedate).getTime() to get the ticks since the zero date. Now the dates will be sorted appropriately without anything fancy.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News & Announcements
-----------------------------
Sigma Visual GUI Builder & Library
-----------------------------
=> Sigma Visual - Knowledge Share
=> Sigma Visual - Q&A
=> Bug Report & Wishlist
-----------------------------
Sigma Grid
-----------------------------
=> Sigma Grid - Q&A
=> Show Case
=> Bug Report & Wishlist
-----------------------------
Other
-----------------------------
=> AJAX & JavaScript
Loading...