PDA

View Full Version : Search Grid by Date Range



rmiclon
8 Dec 2011, 11:07 AM
Hello all,
So, my project is large but fairly simple in the gleam of things. I have a grid where I have docked a toolbar that I am using as a search function for the grid. I have all the search functions working fine. The only thing I am not even remotely close to understanding is how to get a my search function to get the date picker ranges and filter by those dates.

The search looks something like this in the controller


search: function() {
var mystore = Ext.StoreManager.get('log');
mystore.clearFilter(); //clear filter for new search without hitting the clear filter button

// Find the value of the textfield and make sure it matches the grid value
if (Ext.ComponentManager.get('userid').getValue() != null){
mystore.filter('userid', Ext.ComponentManager.get('userid').getValue());
}


So based on this how would i be able to do a date range with two datepickers?
I am using ExtJS 4.x with the MVC structure

mitchellsimoens
9 Dec 2011, 2:38 PM
You will need to use the filterBy method on the Store.

rmiclon
12 Dec 2011, 5:53 AM
mitchellsimoens,
Thanks for your help. I figured filterBy would need to be used. It's how I connect the date ranges since they are two different date fields. Does that make sense?