javascript - MVC Kendo Grid Custom Filter -


basically, looking mvc version of demo:

http://demos.telerik.com/kendo-ui/grid/filter-menu-customization

here have:

.columns(columns =>         {             columns.bound(e => e.id)                 .hidden();             columns.bound(e => e.searchfunctioncode)                 .hidden();             columns.bound(e => e.searchfunctiondesc)                                 .title("search function")                 .filterable( *** goes here? *** )                 .htmlattributes(new { style = "text-align: center" })                 .headerhtmlattributes(new { style = "text-align: center" }); 

do still reference javascript, or there approach?

<script type="text/javascript">     function searchfunctionfilter(element) {         element.kendodropdownlist({             datasource: searchfunctions(),             optionlabel: "--select value--"         });     } </script> 

yes need define specified filter functions in javascript below.

.columns(columns => {         columns.template(@<text>@item.firstname  @item.lastname</text>)                 .clienttemplate("#=firstname# #=lastname#")                 .title("name");         columns.bound(e => e.city)                 .filterable(filterable => filterable.ui("cityfilter"))                 .width(200);         columns.bound(e => e.title)                 .filterable(filterable => filterable.ui("titlefilter"))                 .width(350);        })         .filterable(filterable => filterable         .extra(false)         .operators(operators => operators             .forstring(str => str.clear()                 .startswith("starts with")                 .isequalto("is equal to")                 .isnotequalto("is not equal to")             ))         )        .datasource(datasource => datasource         .ajax()         .read(read => read.action("filtermenucustomization_read", "grid"))      ) )  <script type="text/javascript">     function cityfilter(element) {         element.kendodropdownlist({             datasource: {                 transport: {                     read: "@url.action("filtermenucustomization_cities")"                 }             },             optionlabel: "--select value--"         });     }      function titlefilter(element) {         element.kendoautocomplete({             datasource: {                 transport: {                     read: "@url.action("filtermenucustomization_titles")"                 }             }         });     } </script> 

see this

http://demos.telerik.com/aspnet-mvc/grid/filter-menu-customization


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -