c# - TelerikMvcExtensions Grid filter when using ViewModels -


I am trying to figure out the easiest way to filter my grid.

  @ Html.Telerik (). Grid & lt; MyViewModel & gt; () .name ("grid"). Fillable ();  

I am using ViewModels in my View and DomainModels in my controller. The problem I am trying to map them between using Automapers is that the telephridge grid was not designed to work with view modals, so the filter logic is confused: (

  [GridAction (EnableCustomBinding = true)] Public JsonResult SelectHandled (GridCommand command) {var items = _repository.AsQueriable () .where (command filtered descriptor) // & lt; -------- This will not work. Page (command.page, command page page); var vms = Mapper.Map & lt; INN Merebel & lt; MyModel & gt ;, IEnumera Ble & lt; MyViewModel & gt; & gt; (item); var model = new grid model {data = VMS, total = // omitted}; Jason (model);}  

How do I map myViewModel to MyModel

for filter decoders ? Essentially I want to implement my own.

You can return all records from the controller and The teleormic grid can manage its own filtering logic. With your code, you can try it li:

  [Grid action (enabled custom binding = true)] Selection of public action resultsheld (grid command command) {IEnumerable & lt; MyViewModel & gt; Items = _repository.get (); Var vms = mapper Map & lt; IEnumerable & lt; MyModel & gt;, IEnumerable & lt; MyViewModel & gt; & Gt; (item); Var retColl = New Grid Modell (VMS) {Total = Command. Page size * command.page}; See Return (Retrol); }  

Comments

Popular posts from this blog

mysql - How to enter php data into a html multiple select box -

java - Can't add JTree to JPanel of a JInternalFrame -

c++ - Cassandra datastax cpp driver - avoiding unnecessary copies -