Reputation: 270
I have a Telerik Grid on a MVC3 project with Razor layout engine with the popUp edit mode working fine. Here is the grid code:
@(Html.Telerik().Grid(Model)
.Name("grid-moedas")
.DataKeys(keys => keys.Add(m => m.ID))
.Columns(columns =>
{
columns.Bound(m => m.Nome);
columns.Bound(m => m.Simbolo);
columns.Bound(m => m.ExtensoNoSingular);
columns.Bound(m => m.ExtensoNoPlural);
columns.Command(commands =>
{
commands.Edit();
});
})
.DataBinding(dataBinding =>
{
dataBinding.Ajax().Select("AjaxGrid", "Moeda");
dataBinding.Ajax().Update("AjaxEdit", "Moeda");
})
.Sortable()
.Editable(editing => editing.Mode(GridEditMode.PopUp))
.Pageable(paging =>
paging.Style(GridPagerStyles.NextPreviousAndInput)
)
.Footer(true)
.ClientEvents(events => events
.OnRowSelect("onRowSelect")
)
.Selectable()
)
I wanna two things:
Call the edit command on the OnRowSelect event, so the editing popUp form will be called in response to the user click on a row.
function onRowSelect(e) { //how to call edit command for e.row??? return false; }
Upvotes: 0
Views: 2575
Reputation: 30661
You can try this:
<script>
function onRowSelect(e) {
var grid = $(this).data("tGrid");
grid.editRow($(e.row));
}
</script>
Upvotes: 2
Reputation: 42333
I can't easily try this (I don't have the Telerik controls), but is this of any use:
<script type="text/javascript">
function OnRowClick(sender, args) {
var masterTable = sender.get_masterTableView();
masterTable.fireCommand("Edit", args.get_itemIndexHierarchical())
}
</script>
Taken from here: http://www.telerik.com/community/forums/aspnet-ajax/grid/grid-edit-on-row-select.aspx#1405657
Upvotes: 0