Hi,
I have a Jquery grid that has a column with dropdown values as below. All the CRUD functions work 100% and data displays correctly.
The problem is that the filter for the dropdown list shows the object "[object] [Object]" and not the drop down values from the grid.
I thought I could just use the Filter Menu customization example below... but this doesn't work and doesn't seem to trigger the javascript at all.
https://demos.telerik.com/kendo-ui/grid/filter-menu-customization
var
dataSource =
new
kendo.data.DataSource({
type:
"aspnetmvc-ajax"
,
transport: {
"read"
: {
url:
"/Admin/Wells/GetWells"
},
"update"
: {
url:
"/Admin/Wells/Update"
},
"create"
: {
url:
"/Admin/Wells/Create"
},
"destroy"
: {
url:
"/Admin/Wells/Delete"
}
},
//batch: true,
pageSize: 20,
serverPaging:
true
,
serverSorting:
true
,
serverFiltering:
true
,
serverGrouping:
true
,
serverAggregates:
true
,
schema: {
data:
"Data"
,
total:
"Total"
,
errors:
"Errors"
,
model: {
id:
"Id"
,
fields: {
"Id"
:{
"type"
:
"string"
,
"nullable"
:
false
},
"NAME"
:{
"type"
:
"string"
,
"nullable"
:
false
,
"validation"
: {
"required"
: {
"message"
:
"This field is required"
}}},
"OPERATORFK"
:{
"defaultValue"
: {
"ID"
:
"0"
,
"NAME"
:
""
}}
}
}
}
});
$(gridID).kendoGrid({
sortable:
true
,
autoBind:
false
,
dataSource: dataSource,
filterable:
true
,
filter:
function
(e) {
console.log(
"filter event is fired"
);
},
columnMenu:
true
,
resizable:
true
,
selectable:
"single"
,
autoFitColumn:
false
,
pageable: {
pageSize: 20
},
columns:[
{ field:
"Id"
, nullable:
"false"
, title:
"ENO"
, minResizableWidth:
"125px"
, type:
"string"
},
{ field:
"NAME"
, title:
"Borehole Name"
, minResizableWidth:
"350px"
},
{ field:
"OPERATORFK"
, filterable: { ui: categoryFilter } , title:
"Operator Name"
, minResizableWidth:
"350px"
, values: values, editor: categoryDropDownEditor, template:
"#= (OPERATORFK.NAME == null) ? '' : OPERATORFK.NAME#"
}
],
editable:
"popup"
});
function
categoryFilter(element) {
alert(JSON.stringify(values));
element.kendoDropDownList({
dataSource: values,
optionLabel:
"--Select Value--"
});
}