Forum
00:30
25/02/2012
Hi All,
Thanks so very much for the work on jQgrid! It's an amazing piece of work!
And please direct me to a more appropriate form if this isn't the right one for my question.
I'm attempting to pass a date range to the database query, and it doesn't seem that there's a BETWEEN … AND … functionality in the searchFilter.js file and Google isn't giving up that secret very easily.
I'm using a custom form to build the filter string.
Here's a snippet of what I've got going:
–8<—-
…
case 'This Year':
myTimeframe = thisSec – (60 * 60 * 24 * 365); // 365 days ago
myFilter += '{"field":"c.added","op":"gt","data":"'+ myTimeframe + '"},';
break;
case 'Custom':
fromDate = jQuery("#trDateFrom").val();
toDate = jQuery("#trDateTo").val();
// What operator goes here? Does one exist?
myTimeframe = <<<something>>>
myFilter += '{"field":"c.added","op":"<<<???>>>","data":"'+ myTimeframe + '"},';
…
jQuery.extend(grid[0].p.postData,{filters:myFilter});
grid.trigger("reloadGrid",[{page:1}]);
–8<—-
Is this something that's in the works, or have I overlooked some documentation somewhere? If it makes a difference, I am using jQuery's datepicker plugin.
Thanks again for making this! You've saved me a brazilion hours worth of work, and you guys are the BEST!
00:41
25/02/2012
Nevermind. I found Oleg's post (http://stackoverflow.com/quest.....96#4977896) that describes how to do this.
Basically, the idea is to break down the BETWEEN into two ANDs (eg.
case 'Custom':
fromDate = jQuery("#trDateFrom").val();
toDate = jQuery("#trDateFrom").val();
myFilter += '{"field":"c.added","op":"gt","data":"'+fromDate+'"}'+' {"field":"c.added","op":"lt","data":"'+toDate+'"}';
Thanks anyway!
Most Users Ever Online: 715
Currently Online:
46 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