⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Date range filtering



superdan
  • profile picture
  • Member

Posted 21 August 2013 - 07:49 AM

Hi all,

 

i would like to implement a data range filter in grocery crud.

Unfortunatelly, it seems that for the template flexigrid we have no chance, isnt it?

 

But maybe there is another way:

i found a plugin for datatables that seems to make the job.

 

Here it is

 

http://jquery-datatables-column-filter.googlecode.com/svn/trunk/dateRange.html

 

 

my question is,

anyone have an idea on how can be implemented in GC?

 Thanks for your help!

 

 


Amit Shah
  • profile picture
  • Member

Posted 21 August 2013 - 08:25 AM

Well it is the matter of how good you are at the code.. there are 2 ways you can achieve the same..

1 - alter the basic template .. that i will recommend if and only if.. you insist on applying it across all the GC grids.

2 - Create your own view with option do to an advanced filtration .. the way you want.. and when you submit.. its parameters you get and thats what you set it out on grocerycrud $crud->where() ... method

Both way you can. You need to decide as the way you want to go on with.


superdan
  • profile picture
  • Member

Posted 21 August 2013 - 08:44 AM

Hi amit, thanks for your reply!

both are very interesting ways,

are there any example to do that (i really didnt find any)?


Amit Shah
  • profile picture
  • Member

Posted 21 August 2013 - 09:59 AM

Well to be frank, even i am supposed to come across some examples.. infact i am scheduled to build out some sort of addon for the same but its like in pipe.. not planning it b4 4 weeks atleast.. all tightly scheduled.

 

I am sharing the template file where i altered the code to add my own search box on top in flexigrid .. you can similarly set stuff as what you want and where you want. Then you need to set the correct function accordingly...

 

There was another example i could have shared u but now the site is offline..

that 1 was purely custom filter outside .. in my own view .. if i find the code i will share you the sample .. but for timebeing u can refer to this and try and implement.


superdan
  • profile picture
  • Member

Posted 21 August 2013 - 12:06 PM

thanks amit,

 

ill wait for the code cus i really cant understand anything of your file!


Amit Shah
  • profile picture
  • Member

Posted 21 August 2013 - 12:32 PM

well.. that is the basic list template of flexigrid..

no problem.. keep looking in.. u might get the code 3-4 weeks from now :)


Ador El
  • profile picture
  • Member

Posted 29 November 2014 - 05:48 AM

Hey Amit, I have a question about the code in your file

I added the file in

assets/grocery_crud/themes/flexigrid/views/list_template.php

Then I display the list and get the search bar at the right top of flexigrid.

 

Could you provide some kind of sample code to manage timestamp in that search bar?

 

 

 

I was thinking on something for a timestamp range (start and stop values) adding variables startTime and stopTime with String values such as "12/12/2014 16:03"

$('#useTimeRange').change(function() {
  if( this.checked ) { //limit events to timestamp range
  //alert("Checked " + startTime + " " + endTime);
  var data = {name: 'startTime', value: $("#startTime").val()};
  var data2= {name: 'endTime', value:$("#endTime").val()};
  $('.flex5').flexOptions({params: [ data, data2 ]}).flexReload(); 
}

Amit Shah
  • profile picture
  • Member

Posted 29 November 2014 - 14:26 PM

Well frankly speaking - this search bar is a replica of the search bar below in the flexigrid theme - have not looked in yet for setting up anything like timestamp or so .. !! But u can explore.. do share me your exact need / requirement like what you looking in for .. and i might get an wild idea to solve it and share... but dont expect stuff like it before Tuesday noon (IST) cuz i have a deadline to meet.

U share your need and if i have time - will definately look into the same else .. post Tuesday (u may remind me of the same)


Ador El
  • profile picture
  • Member

Posted 29 November 2014 - 18:13 PM

Alright, thank you so much, I will try to solve the issue.