@(Html.EJ().Grid<object>("Grid")
………………….
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
………..
}).CustomToolbarItems(new List<object>() { new Syncfusion.JavaScript.Models.CustomToolbarItem() { TemplateID = "#Details" } });
}).ClientSideEvents(eve => eve.Create("create").ToolbarClick("ToolBarClick"))
.Columns(col =>
{
…………..
})
)
<script>
function ToolBarClick(args) {
if (args.itemName == "Details") {
$.ajax({
type: "POST",
url: "/Grid/GetData",
datatype: "json",
contentType: "application/json; charset=utf-8",
success: function (data) {
var gridObj = $("#Grid").ejGrid('instance'); // create grid instance using grid ID
gridObj.dataSource(data);
$("#showopen").html('Updated'); // Use button ID here.
alert("data source refreshed and button text changed") },
});
}
}
</script>
<script type="text/x-jsrender" id="Details">
<button class="btn btn-info" type="button" id="showopen">
Show Open
</button>
</script> |