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

Kendo Grid selected row grid to form control

2 Answers 225 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saran
Top achievements
Rank 1
Saran asked on 21 Feb 2013, 03:52 PM
Hi,

I am trying to load a html form just below the kendo grid for edit from the selected Kendo Grid row. I am able to get the selected grid row using events and dataitem. ( var dataItem = this.dataItem($(e.currentTarget).closest("tr"));)

How do we bind it to the editable html form? Do we have any functionality like gridtoform? Is there any demo related to this?

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 25 Feb 2013, 10:47 AM
Hi,

You could use the MVVM functionality to bind the item to the form inputs e.g.

<form action="/" method="post" id="myForm">
    <input type="text"  data-bind="value: selectedItem.MyField"/>
</form>
var viewModel = kendo.observable({
    selectedItem: null
});
kendo.bind($("#myForm"), viewModel);
function customCommand(e) {
    e.preventDefault();
    var row = $(e.currentTarget).closest("tr");
    var dataItem = this.dataItem(row);
    viewModel.set("selectedItem", dataItem);
     
}
Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Saran
Top achievements
Rank 1
answered on 25 Feb 2013, 11:24 PM
Hi Daniel,

Thanks for the reply. I was able to bind the grid row data item to the form.

Thanks,
Saran
Tags
Grid
Asked by
Saran
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Saran
Top achievements
Rank 1
Share this question
or