Good Afternoon,
I'm trying to get the value of primary key from row that i double click, but it doesn't show nothing.
@(Html.EJ().Grid<object>("grid")
.Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.datasource).InsertURL("/Home/PerformInsert").UpdateURL("/Home/PerformUpdate").RemoveURL("/Home/PerformDelete").Adaptor(AdaptorType.RemoteSaveAdaptor))
.ToolbarSettings(tool => tool.ShowToolbar().ToolbarItems(item =>
{
item.AddTool(ToolBarItems.Add);
item.AddTool(ToolBarItems.Cancel);
}))
.IsResponsive(true)
.EnableResponsiveRow(true)
.AllowFiltering()
.FilterSettings(filter => { filter.FilterType(FilterType.Menu); })
.AllowSorting(true)
.AllowPaging()
.AllowGrouping()
.AllowResizing().AllowResizeToFit().AllowTextWrap()
.Columns(col =>
{
col.Field("codigo_perfil").Visible(true).HeaderText("Código Perfil").IsIdentity(true).IsPrimaryKey(true).TextAlign(TextAlign.Right).Add();
col.Field("descricao").HeaderText("Descrição").AllowEditing(false).Add();
col.Field("ativo").HeaderText("Ativo").EditType(EditingType.Boolean).TextAlign(TextAlign.Center).Add();
col.Field("codigo_tipo").HeaderText("Tipo").AllowEditing(false).Add();
col.Field("codigo_acesso").HeaderText("Acesso").AllowEditing(false).Add();
})
.PageSettings(p => p.PageCount(3).PageSize(7))
.ClientSideEvents(eve =>
{
eve.RecordDoubleClick("recordDoubleClick");
})
)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
function recordDoubleClick(args) {
var grid = $("#grid").ejGrid("instance");
var index = grid.getIndexByRow(this.element.closest("tr"));
var record = grid.getCurrentViewData()[index];
var primaryKeyValue = record[codigo_perfil];
document.getElementById('labelId').textContent = primaryKeyValue;
}
Thanks for now.