Extjs 4 grid filter in Asp.net MVC action table query and filtering best resolution Solution
Public class extfilterinfo
{
Public String Field {Get; set ;}
Public extfilterdata data {Get; set ;}
}
Public class extfilterdata
{
Public string type {Get; set ;}
Public String Value {Get; set ;}
Public String comparison {Get; set ;}
} Method in action
Public actionresult orderdata (INT start, int limit, string sort, extfilterinfo [] filter)
{
Return view ();
}
Parsing Model Data Binding
Public class extfilterinfomodelbinder: defaultmodelbinder
{
Public override object bindmodel (controllercontext, modelbindingcontext bindingcontext)
{
VaR filter = (extfilterinfo) base. bindmodel (controllercontext, bindingcontext );
VaR field = bindingcontext. valueprovider. getvalue (bindingcontext. modelname + "[field]");
If (field! = NULL)
{
Filter. Field = field. attemptedvalue;
}
VaR type = bindingcontext. valueprovider. getvalue (bindingcontext. modelname + "[data] [type]");
VaR value = bindingcontext. valueprovider. getvalue (bindingcontext. modelname + "[data] [value]");
VaR comparison = bindingcontext. valueprovider. getvalue (bindingcontext. modelname + "[data] [comparison]");
If (filter. Data = NULL)
{
Filter. Data = new extfilterdata ();
}
If (type! = NULL)
{
Filter. Data. type = type. attemptedvalue;
}
If (value! = NULL)
{
Filter. Data. value = value. attemptedvalue;
}
If (comparison! = NULL)
{
Filter. Data. Comparison = comparison. attemptedvalue;
}
Return filter;
}
}
Register registered inApplication_start Method
Protected void application_start ()
{
Arearegistration. registerallareas ();
Registerroutes (routetable. routes );
Modelbinders. binders. Add (typeof (extfilterinfo), new extfilterinfomodelbinder ());
}
Everything is OK !!!