Editing Kendo Grid InCell => saveEvent (e) => e.values
I am using Grid from Kendo UI to display a bunch of data and now I want to add editing to InCell.
Since JavaScript is not the strongest point, I see no solution for my next problem:
The grid is set as:
.Editable(e => e.Mode(GridEditMode.InCell))
.Selectable(e => e.Mode(GridSelectionMode.Single).Type(GridSelectionType.Cell))
.Events(events => events.Save("subfileSaved")
Data source batch mode is set to false.
Now in my function, subfileSaved(e)
I am getting the modified values ββin e.values
. According to Firebug, the value e.values
is Object { Fields[2].Content="11CLS1511"}
.
Q: What is the best way to extract and 2
from Fields[2].Content
as well as receive 11CLS1511
?
Edit: e.values.Fields[2].Content
doesn't work, see
source to share
Are you sure Fields is a collection that you can access, or is it rather an enumeration of your Firebug ViewModel?
For example, what is the model the mesh is anchored to?
If I have a mesh with a model like this:
Html.Kendo().Grid<AddressListViewModel>().Name("AddressList")
.Columns(c2 =>
{
c2.Bound(w => w.AddressTypeId).Title("Address Type").ClientTemplate("<#= AddressTypeDisplay #>");
c2.Bound(w => w.AddressDisplay).Title("Common Name");
.. miss a few
.Events(events => events.Save("subfileSaved"))
Then in Save you can check all values ββlike:
function subfileSaved(e) {
var someValue = e.Model.AddressDisplay;
debugger;
}
Kendo does all the hard work for you and gives you a nice named instance for reading the model and fields. I'm just wondering if you need to explicitly access the model and properties, but without your complete mesh code it's hard to tell for sure.
source to share