@Html.EJS().Grid("grid").DataSource((IEnumerable<object>)ViewBag.DataSource).Height(400).Columns(col =>
----}).AllowPaging().EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }). RowSelected("RowSelected").Render()
<script>
var dialog;
function RowSelected(args){
var gridObj = document.getElementsByClassName("e-grid")[0].ej2_instances[0];
// get the rowInfo using target cell
var rowInfo = gridObj.getRowInfo(args.target);
// shows the row info in the console
console.log(rowInfo);
console.log(rowInfo.rowData)
// create the dialog
dialog = new ej.popups.Dialog({
// Enables modal dialog
isModal: true,
// overlayClick event handler
overlayClick: onOverlayClick,
// Dialog content – bind the row info
content: JSON.stringify(rowInfo),
// The Dialog shows within the target element
target: gridObj.element.getElementsByClassName("e-gridcontent")[0]
});
var x = document.createElement('div');
x.setAttribute('id', 'dialogrowinfo');
gridObj.element.appendChild(x)
dialog.appendTo(x);
}
function onOverlayClick() {
// hide the dialog
dialog.hide();
}
</script>
|