Hey guys,
I have a problem with the Grid + custom editor widget.
The custom editor, in this case "productDropDownEditor", should show the productName and update the field value with productID.
When you select an item on the DropDownEditor the grid shows the productID instead of the productName.
What am I doing wrong?
Dojo: http://dojo.telerik.com/AlEGU
10 Answers, 1 is accepted
Try to use the same approach as the one in the following online example. Note that the Category field in the data source for the grid is an object.
Regards,
Viktor Tachev
Telerik

Hi,
I'm sitting on this problem for a week now but without success..
I need a grid with a custom editor like in the example http://demos.telerik.com/kendo-ui/grid/editing-custom.
But in the example the categoryDropDownEditor is using odata, is it also possible with json?
For me it's not working with json transport. This line (especially the template: )seems not to work with json:
{ field:
"Category"
, title:
"Category"
, width:
"180px"
, editor: categoryDropDownEditor, template:
"#=Category.CategoryName#"
},
You can configure the dataSource of the custom editor so that it uses JSON. In that case you should omit the type property.
The following dojo illustrates how you can use Kendo DataSource with JSON.
Regards,
Viktor Tachev
Telerik

Hi Viktor,
thanks for your answer!
I'm still struggling with my problem: I need to show ProductName but set the value to ProductID.
Can you tell me why it's showing the ProductID instead of the ProductName after selecting an item in the dropdownEditor http://dojo.telerik.com/AlEGU ?
Check out the following dojo where the approach is illustrated:
Regards,
Viktor Tachev
Telerik

Hi Viktor,
thank you, this helped me to understand and fix my problem.
But now another problem occurs: When I click "Add new record" in your Dojo http://dojo.telerik.com/AlEGU/7 it throws out an error
1.
ReferenceError: Category is not defined

Hi Viktor,
I just figured out ow to solve my ReferenceError, by setting a default value.
But now another problem: When set "group" in dataSource the grid throws out "undefined" after choosing an item.
01.
function
produktDropDownEditor(container, options) {
02.
$(
'<input required data-value-field="produkt_id" data-text-field="produkt_name" data-bind="value:'
+ options.field +
'"/>'
)
03.
.appendTo(container)
04.
.kendoComboBox({
05.
optionLabel:
"Artikel auswaehlen.."
,
06.
autoBind:
false
,
07.
minLength: 3,
08.
filter:
"contains"
,
09.
template:
'<small>#: produkt_id # </small> #: produkt_name # #: produkt_cc #ml'
,
10.
fixedGroupTemplate:
"#:data#"
,
11.
dataSource: {
12.
type:
"json"
,
13.
transport: {
14.
read: crudServiceBaseUrl +
"/productsJson"
,
15.
dataType:
"json"
16.
},
17.
group: { field:
"produkt_kellerei"
},
18.
schema: {
19.
data:
'data'
20.
}
21.
}
22.
});
23.
}
I attached two images where you can see that everything (grouping) looks good in the dropdown but after selecting the grid throws out "undefined".
Can you tell me what's wrong here?
Would you modify the following dojo in a way that the behavior you are seeing is replicated and provide a link? Thus, we would be able to examine the issue and look for what could cause it.
Regards,
Viktor Tachev
Telerik

Hi Viktor,
thanks for your reply.
While inserting and modifying my code into Dojo,it worked fine. I found out that using the latest Kendo UI version fixes the problem (I used v2015.2.624).
But thank you so much again!
I am glad that the issue is resolved. Thank you for sharing your findings with the community.
Regards,
Viktor Tachev
Telerik