I would like to make my Kendo Grid editable only for a certain cells (depends on a value in them) or only a certain columns (i.e. only the second column in grid). How can I achieve this goal?
Ok, I partialy resolved the second problem. Disabling editing on a certain column is as simple as define it impossible in data schema, as stated in documentation:
vardataSource = newkendo.data.DataSource({
//..
schema: {
model: {
id: "ProductID",
fields: {
ProductID: {
//this field will not be editable (default value is true)
editable: false,
// a defaultValue will not be assigned (default value is false)
nullable: true
},
ProductName: {
validation: { //set validation rules
required: true
}
},
UnitPrice: {
//data type of the field {Number|String|Boolean} default is String
type: "number",
// used when new model is created
defaultValue: 42,
validation: {
required: true,
min: 1
}
}
}
}
}
});
Like I said, this is a partial solution, due to the fact, that I can specify some additional columns in grid, that are not fetched from DataSource, but are added for example from template:
columns: [
{
field: "id",
title: "ID"
},
{
field: "firstName",
title: "First Name"
},
{
field: "lastName",
title: "Last Name"
},
{
title: "Actions",
template: '<a href="javascript:vm.editUser(#= id #)">Edit</a> <a href="javascript:vm.removeUser(#= id #)">Delete</a>'
}
]
In the latter case, there is no schema in which I could define, that column entitled "Actions" should not be editable.
I'd really like to achieve something similar to this. I need an editable grid, which has certain fields that are not from the data source.
Basically, I retrieve a list of employees from the remote data source and display them in a grid, but I need to be able to save additional data associated with each employee into a different table.
I can achieve this using a row template and lots of input fields, but I'd rather use the grid's built in editable features as they are a much better user experience.
Is there any way to do this? If so, is there aslo a way to make one of the additional 'pseudo' columns into a drop-down list?