kendo ui - Pop Up Edit Form for a grid: how can I know which is the currently selected row -
i have grid has edit set popup.
in grid model, have defined field level validation uniqueness below. how can know select row can avoid comparing field value same row's value?
model: { id: "id", fields: { id: { nullable: false, editable: false, hidden : true }, "timestamp": { type: "date", validation: { // validation rules required: true, // field required unique: function (input) { if (!input.is("[name=timestamp]")) { return true; } input.attr("data-unique-msg", '${msg.unique_time}' ); var data = grid.datasource.data(); //how can know row selected?
maybe little tricky solution should work... each record in datasource has unique id assigned kendo ui. these uid
, popup
editing used in window in such way kendo ui can identify record being edited without having save state. should same.
your function need do:
var uid = $(input).closest(".k-popup-edit-form").data("uid"); var item = grid.datasource.getbyuid(uid);
now, item
contains fields of record being edited.
Comments
Post a Comment