PDA

View Full Version : [CLOSED] Remote filtering via AjaxProxy and ASHX handler vs Page Proxy and Store's OnReadData event



anup
Jun 02, 2012, 5:17 PM
Hi,

Your Grid with Remote Filtering example is useful:
http://examples2.ext.net/#/GridPanel/Plugins/GridFilters_Remote/

When I opt to use an AjaxProxy with an ASHX handler instead, I can create an instance of StoreRequestParameters based on the context.

So I can do something like this (where CompanyData is the object I am working with):


public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";

var requestParams = new StoreRequestParameters(context);

int start = requestParams.Start;
int limit = requestParams.Limit;

Paging<CompanyData> data = GetData(start, limit);

context.Response.Write(JSON.Serialize(data));
}


I was hoping to instantiate the same FilterConditions you do in your example above.

I can get the start, limit and other such properties off the StoreRequestParameters, but, when it comes to the Filter property, instead of being a string (or an already instantiated FiltersCondition class), the filter property is an array of DataFilter classes. Furthermore, that DataFilter doesn't contain things like which operator was selected (greater than, etc) - only the value. It looks like DataFilter is really a class used to help construct a component, rather than represent a request parameter?

So, what I find I need to do instead is read it off the querystring manually like this



var filterConditions = new FilterConditions(context.Request["filter"]);


This is fine, but for the book chapter on this, I'd probably need to explain to a reader why we can't get this off the StoreRequestParameters like the rest of the properties. Come to think of it could the filter also be added to it? Maybe as an already-instantiated FilterConditions instance (or null if no filters set)? If the current Filters property is needed on the StoreRequestParameters class then maybe another property could be added called FilterConditions of type FilterConditions?

Thanks!

Vladimir
Jun 03, 2012, 3:37 PM
Filter property of StoreRequestParameters is used for standard store's filters (if remoteFilter is true) and match the following class
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.util.Filter

Filter property is not related with GridFilters plugin at all
I don't think that including FilterConditions to the StoreRequestParameters class is good idea becauce GridFilters is plugin (not part of standard framework and store)

anup
Jun 03, 2012, 4:18 PM
Thanks for replying over the weekend. You are of course right - that was a silly question from me in hindsight! Got grids stuck in my head :)

I can create always create a subclass for my purposes, to wrap this if I want.