@Html.EJS().Button("RefreshButton").Content("Refresh").CssClass("e-info").Render()
@(Html.EJS().Grid("ProductGrid").DataSource(ds => ds.Url("/Home/UrlDatasource").Adaptor("UrlAdaptor").InsertUrl("/Home/Insert").RemoveUrl("/Home/Remove").UpdateUrl("/Home/Update")).Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("120").Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("150").Add();
col.Field("OrderDate").HeaderText("Order Date").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Width("130").Format("yMd").Add();
} ).AllowPaging().EditSettings(edit => { edit.AllowEditing(true).AllowAdding(true).AllowDeleting(true); }).Toolbar(new List<string>
() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render())
<script type="text/javascript">
document.getElementById('RefreshButton').addEventListener("click", function () {
var grid = document.getElementById("ProductGrid").ej2_instances[0]; // grid instance
grid.refresh();
});
</script> |
@Html.EJS().Button("RefreshButton").Content("Refresh").CssClass("e-info").Render()
@Html.EJS().Grid("RestockGrid").DataSource(ds => ds.Url(@Url.Action("RestockData","Amazon")).Adaptor("UrlAdaptor")).Columns(col => ...
<script type="text/javascript">
document.getElementById('RefreshButton').addEventListener("click", function () {
new ej.DataManager({
url: "/Amazon/RestockData",
adaptor: new UrlAdaptor < --this causes an "undefined" error
}).executeQuery(new Query().take(14)).then((e) => {
//e.result will contain the records
$("#RestockGrid").ejGrid("dataSource", e.result);
});
});
</script> |
<script type="text/javascript">
document.getElementById('RefreshButton').addEventListener("click", function () {
var grid = document.getElementById("RestockGrid").ej2_instances[0]; // ej2-grid instance
grid.dataSource = new ej.data.DataManager({ // assigned the new datasource to Grid
url: "/Amazon/RestockData",
adaptor: new ej.data.UrlAdaptor()
});
});
</script> |
Button Click:
<script type="text/javascript">
document.getElementById('RefreshButton').addEventListener("click", function () {
var grid = document.getElementById("RestockGrid").ej2_instances[0]; // ej2-grid instance
grid.query = new ej.data.Query().addParams('additionalParams', 1);
grid.dataSource = new ej.data.DataManager({ // assigned the new datasource to Grid
url: "/Amazon/RestockData",
adaptor: new ej.data.UrlAdaptor()
});
});
</script>
Controller:
public ActionResult RestockData(DataManagerRequest dm, int? additionalParams)
{
...
} |