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

Updating editable primary key field in grid

0 Answers 366 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dragan
Top achievements
Rank 1
Dragan asked on 12 Mar 2013, 01:22 PM
Hello everybody,

I am very new at KendoUI, so please excuse me if me question sounds silly.

I have a KendoUI grid on a page displaying some data. I defined data source with JSON POST methods to my ASP.NET MVC code and am using popup editing mode. I have schema definition in data source that goes something like this:
model: {
    id: "SID",
    fields: {
        //kuiRecordKey: { type: "number", editable: false, nullable: true },
        SID: { type: "number", editable: true, nullable: false },
        Name: { validation: { required: true, maxlength: 50 }, type: "string" },
        Second: { type: "number", validation: { required: false, min: 0, max: 1 } },
        Third: { type: "number", validation: { required: false, min: 0, max: 1 } }
    }
As you can see I am making primary key field editable. It does not make sense in all occasions, but in some it is necessary. If I run it like this, I will end up with a popup which will allow me to change the primary key field value and do POST of this changed value.

The real question here is: how do I get to know the ORIGINAL primary key value so I could know which row in database to change? I am trying to construct additional field here that would hold this value in case of an edit (kuiRecordKey - commented in the code above) and POST it so my processing logic would pick it up and use it accordingly.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Dragan
Top achievements
Rank 1
Share this question
or