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

Inline dropdown: data is not updated when change from empty value

2 Answers 818 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vitaliy
Top achievements
Rank 1
Vitaliy asked on 22 Aug 2015, 01:40 PM

Hello,

 

I have a grid like the following:

$("#grid").kendoGrid({
        dataSource: {
            batch: true,
            data: [
                {id: 1, statusId: 1, label: 'item1'},
                {id: 2, statusId: 1, label: 'item2'},
                {id: 3, statusId: 2, label: 'item3'},
                {id: 4, statusId: null, label: 'item4'}
            ],
            model: {
                id: 'id',
                fields: {
                    id: {type:'number', editable: false},
                    statusId: {type:'number', editable: true},
                    label: {type:'string', editable: true}
                }
            }
        },
        columns : [
                   { field: 'statusId', values: [ {value:1, text:'Status1'}, {value:2, text:'Status2'} ] },
                   { field: 'label'}
        ],
        editable: true
    }).data("kendoGrid");​

 

statusId column contains an identifier according to the linked values dictionary. When I double click a statusId cell I get a dropDownList with Status1 and Status2 options.

 

Then if I click a statusId cell having non empty value (e.g. row 1), change statusId to another value, click on another row - statusId text is properly updated.

But if I click a statusId cell having an empty value ( row 4), change statusId to​ any non empty value, click on another row - statusId text is not updated in the row 4 statusId cell.

Could you help to solve this issue?

The ideas is to have nullable statusId , linked to a dictionary, where null value is missing. Everything works fine if I try to ​change not empty value. But doesn't work what I try change empty value to not empty.

2 Answers, 1 is accepted

Sort by
0
Vitaliy
Top achievements
Rank 1
answered on 24 Aug 2015, 05:33 AM
0
Accepted
Vladimir Iliev
Telerik team
answered on 26 Aug 2015, 06:48 AM
Hi Vitaliy,

Basically the editor need to have "valuePrimitive" option set to true when the initial value might be null. This option can be set using custom editor as seen in the following demo:

Regards,
Vladimir Iliev
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
Vitaliy
Top achievements
Rank 1
Answers by
Vitaliy
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or