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
Is Between SQL
25/02/2012
00:30
Avatar
Andrius Ilgunas
New Member
Members
Forum Posts: 2
Member Since:
25/02/2012
sp_UserOfflineSmall Offline

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! :)

25/02/2012
00:41
Avatar
Andrius Ilgunas
New Member
Members
Forum Posts: 2
Member Since:
25/02/2012
sp_UserOfflineSmall Offline

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! :)

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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