This is a migrated thread and some comments may be shown as answers.

Grid and custom editor - Am I too stupid?

10 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Benny
Top achievements
Rank 1
Benny asked on 14 Sep 2015, 10:29 AM

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

Sort by
0
Viktor Tachev
Telerik team
answered on 15 Sep 2015, 02:08 PM
Hi Benny,


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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Benny
Top achievements
Rank 1
answered on 24 Sep 2015, 06:24 PM

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#" },

0
Viktor Tachev
Telerik team
answered on 28 Sep 2015, 12:43 PM
Hello Benny,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Benny
Top achievements
Rank 1
answered on 28 Sep 2015, 02:01 PM

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 ?

0
Accepted
Viktor Tachev
Telerik team
answered on 29 Sep 2015, 02:01 PM
Hello Benny,

Check out the following dojo where the approach is illustrated:



Regards,
Viktor Tachev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Benny
Top achievements
Rank 1
answered on 30 Sep 2015, 07:38 PM

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

What's going wrong?
0
Benny
Top achievements
Rank 1
answered on 01 Oct 2015, 01:05 PM

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?

0
Accepted
Viktor Tachev
Telerik team
answered on 01 Oct 2015, 02:22 PM
Hello Benny,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Benny
Top achievements
Rank 1
answered on 01 Oct 2015, 09:07 PM

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!

0
Viktor Tachev
Telerik team
answered on 02 Oct 2015, 12:11 PM
Hi,

I am glad that the issue is resolved. Thank you for sharing your findings with the community.

Regards,
Viktor Tachev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Benny
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Benny
Top achievements
Rank 1
Share this question
or