or
<div style="width: 700px"> @(Html.Kendo().Grid<RoleGridModel>() .Name("grdRoles") .Columns(columns => { columns.Bound(r => r.Name).Width(200); columns.Bound(r => r.Description).Width(300); columns.Command(command => { if (security.CanAdd || security.CanUpdate) command.Edit(); if (security.CanDelete) command.Destroy(); }).Width(200); }) .Groupable(grouping => grouping .Enabled(false)) .Events(events => { if (security.CanAdd && !security.CanUpdate) events.DataBound("function() { this.table.find('.k-grid-edit').hide(); }"); }) .DataSource(dataSource => dataSource .Ajax() .Model(model => model.Id(r => r.RoleId)) .Events(events => events.Error("error_handler")) .Read(read => read.Action("Index", "Roles", new { area = "Setup" })) .Create(create => create.Action("Create", "Roles", new { area = "Setup" })) .Update(update => update.Action("Edit", "Roles", new { area = "Setup" })) .Destroy(destroy => destroy.Action("Delete", "Roles", new { area = "Setup" })) .Sort(sort => sort.Add(r => r.Name).Ascending()) .PageSize(10)) .Filterable(filtering => filtering .Enabled(true)) .Editable(editable => editable.Mode(GridEditMode.InLine)) .Pageable(paging => paging .Enabled(true) .Info(true) .PageSizes(false) .Refresh(true)) .Scrollable(scrolling => scrolling .Enabled(false) .Height(400) .Virtual(false)) .Sortable(sorting => sorting .Enabled(true) .AllowUnsort(false) .SortMode(GridSortMode.SingleColumn)) .ToolBar(toolbar => { if (security.CanAdd) toolbar.Create(); }) )</div>[HttpPost]public ActionResult Edit([DataSourceRequest] DataSourceRequest request, RoleGridModel model){ if (ModelState.IsValid && model != null) { try { Role r = Mapper.Map<RoleGridModel, Role>(model); r.AppContext = this.AppContext; r.SubscriberId = this.AppContext.SelectedSubscription.SubscriberId; r.SubscriptionId = this.AppContext.SelectedSubscription.SubscriptionId; r.ModifyDate = DateTime.UtcNow; r.IsNew = false; r.IsMarkedForDelete = false; r.HasChanges = true; r.Save(); } catch (Exception ex) { LogException(ex); ModelState.AddModelError("", "Unable to update role. " + ex.Message); } } return Json(ModelState.ToDataSourceResult());}Hi
I am using the following syntax to use a the javascript function for adding a dropdown to a filter within a column of a grid:columns: [ { title: "Typ", field: "FileExtension", width: 50, filterable: { ui: dropDownFilter } }, { title: "Titel", field: "Title", width: 360, filterable: { ui: dropDownFilter } },Within the javascript function "typeFilter" I would like to know the column or better the field of the columnto build a javasript function that can work dynamically for several columns.So is there a way to get the field ("FileExtension") within the javascript function or a way to pass it down to it?function dropDownFilter(element) { element.field ?????}Thanks for your help!Best regards,Pascal Hohensträter