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

Custom editing kendo grid

3 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Poonam
Top achievements
Rank 1
Poonam asked on 09 Jan 2013, 10:54 PM
Hi
I am using kendo grid and want a column cell to be editable based on the value in other column cell in the grid row.
for example if i have a "xyz"  value in column one then second column in grid should not be editable.
I want to make this custom editing for all rows in the grid .

please guide me to accomplish it.

Regards,

Poonam

3 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 10 Jan 2013, 01:04 PM
Hi Poonam,

Please check this forum thread which describes how the desired functionality can be achieved. 

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Poonam
Top achievements
Rank 1
answered on 10 Jan 2013, 08:47 PM
Thank you for your reply.

I have another question that how to add drop down list to only one cell in a grid column. let's say i have two columns in my kendo grid first column is non editable while second one is edtiable, and if  first column has "county" value then in second column i want to add drop down list to select country and rest of values in the second column should be editable. how to bind that drop down list to a grid column cell and make other column cells editable in second column?

Thank you.
0
Accepted
Alexander Valchev
Telerik team
answered on 14 Jan 2013, 09:58 AM
Hi Poonam,

To edit a field with a DropDownList widget you can use the custom editor option. This demo demonstrates the approach. Please pay attention to the editor function - in your particular case you may check what is the value of the first column and render different editors according to a condition.
function categoryDropDownEditor(container, options) {
    //options.model contains all the fields of the current row
    //render editors according to your custom logic
    $('<input data-text-field="CategoryName" data-value-field="CategoryID" data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoDropDownList({
            autoBind: false,
            dataSource: {
                type: "odata",
                transport: {
                    read: "http://demos.kendoui.com/service/Northwind.svc/Categories"
                }
            }
        });
}

I would like to point out that it is important to bind the editor input to the editable field:
data-bind="value:' + options.field + '


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