Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150807 | Jan 20,2020 11:37 PM UTC | Jan 23,2020 07:18 AM UTC | ASP.NET MVC - EJ 2 | 3 |
![]() |
Tags: Grid |
@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>
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.