⚠ 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

How to Add search Filter between two date in list view



Haseeb Ashfaq

Haseeb Ashfaq
  • profile picture
  • Member

Posted 05 December 2013 - 12:34 PM

Hi friends

 

i am using twitter-bootstrap theme in my application.

my problem is that how i add search Filter between two date in list view search option at the top of GRID.

 

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 05 December 2013 - 17:38 PM

Hi there - since it is a custom solution that you look to implement - i will recommend the same inside the CI's view that gets loaded. The same can be submitted as post to the same controllers action ... set the dates into session and filter the data based on the dates set! That should solve your issue. I will recommend a solution into the session as most of the times the data is going to be retrieved is through Ajax calls and the same will be needed to be filtered.

 

A note of caution - will recommend you parse the availability of the keys into the post .. if those are available - update the value in the session...

 

Happy GCing :)


carperolm

carperolm
  • profile picture
  • Member

Posted 27 February 2014 - 07:54 AM

Hi Amit,

 

Did you finish that code? I'm looking for a similar solution.

 

Thanks


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 27 February 2014 - 08:32 AM

i did finish and i also deployed the same.. on many of my projects!!

 

Download the file from here and check them out - though they may not look out super intesive like the dashboard styled design.. but its all as per the requirements ... and it suites fine.. gells fine in within the design.


carperolm

carperolm
  • profile picture
  • Member

Posted 03 March 2014 - 09:57 AM

Hi Amit,
 
Thanks for your fast answer.
 
Why did you send me that file? I need to filter search result by date range? Could you share you code or tell me the best way to develop it?
 
Thanks in advance.

Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 03 March 2014 - 19:59 PM

Extreamly sorry dudes - i by mistake shared some1 elses reply along with you... i will look up for the solution i have provided in my earlier project and then share you the same..!!


carperolm

carperolm
  • profile picture
  • Member

Posted 10 March 2014 - 15:55 PM

Hi Amit,
 
Could you indicate me how I should develop the solution? Would be great if you share the code! I'm spending lot of time without any results :(
 
Thanks in advance.

Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 11 March 2014 - 11:03 AM

Well.. i am really sorry for not in position to build anything as such... running out of time in crunch... Wanted to develop an extension for the same but meanwhile i will share you some tips / guide you on the same. Well you can create a custom crud view where u can specify your start / end date with a submit button on the same. When one selects the date range and clicks on submit ... submit it to the action.. .capture the date there.... and store it in session... yes this is very important step .. to store it in session because without it you it wont work.

Now treat the code as every regular other request that would come in. Retrieve the date values from session every time the request comes up... set that in crud->where clause...That should give you your filtered data for sure.

Here is the tip in case you want to clear your search parameters on the revisit of the user to the same page.

/topic/2434-clear-the-search-on-revisit/

 

You may add your cleanup code in here along with the existing code...

 

Extremely sorry about the same but will surely put in efforts for building an search / filter plugin (i myself am eagerly waiting to build the same)

 

Happy GCing:)