Hello, I hope someone can help me out with this problem I am struggling with.
I am attempting to use a multi select as an editor for a column within my grid. This column itself is actually an object which I use a template to display the text content within the grid:
"accountReps"
: {
"primary"
: [{
"userId"
: 1234,
"name"
:
"Person name"
}],
"secondary"
: []
}
These properties are also both set as editable in the schema model
"accountReps.primary"
: {
"type"
:
"object"
,
"editable"
:
true
,
"nullable"
:
false
,
"validation"
: {
"required"
:
false
}
},
"accountReps.secondary"
: {
"type"
:
"object"
,
"editable"
:
true
,
"nullable"
:
false
,
"validation"
: {
"required"
:
false
}
}
When its comes to the editor I can display the editor and populate the initial values fine, but when persisting back to the grid the data is not to be mapping to my object correctly. The code I am using for the editor is:
$(
'<select name="'
+ options.field +
'"/>'
)
.appendTo(container)
.kendoMultiSelect({
placeholder:
"Select"
,
autoBind:
false
,
dataTextField:
"Name"
,
dataValueField:
"Id"
,
valuePrimitive:
true
,
dataSource: ds,
change:
function
(e) {
console.log(
'change'
);
},
select:
function
(e) {
console.log(
'select'
);
},
dataBound:
function
() {
var
fieldValues = options.model.get(options.field).map(
function
(item) {
return
item.userId.toString();
});
this
.value(fieldValues);
}
});
I believe its just setting the selected ids as the value for my column. I'm hoping for an event I can use to set the value correctly or a way to map the object.
Any help would be much appreciated.
John