@(Html.EJ().Grid<Object>("Grid")
.Datasource((IEnumerable<Object>)ViewBag.dataSource)
.ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.ExcelExport);
items.AddTool(ToolBarItems.WordExport);
items.AddTool(ToolBarItems.PdfExport);
}))
.Columns(col =>
{
col.Field("payment_date").HeaderText("Početak").Format("{0:dd.MM.yyyy.}").Type("date").Width(100).Add();
col.Field("fund_amt").HeaderText("Amount Invested").Format("{0:n0}").TextAlign(TextAlign.Right).Add();
col.Field("commision_items_value").HeaderText("Commission Entitlement").Format("{0:p0}").TextAlign(TextAlign.Right).Add();
col.Field("amt").HeaderText("Profit Bonus").Format("{0:n0}").TextAlign(TextAlign.Right).Add();
col.Field("currentcy_Code").HeaderText("Currency").TextAlign(TextAlign.Right).Add();
})
.ClientSideEvents(eve => { eve.QueryCellInfo("formatingCell"); })
) |
<button id="Btn" onclick="data()">Data Bind</button>
@(Html.EJ().Grid<Object>("Grid")
…………………………………………………………..
.ClientSideEvents(eve => { eve.QueryCellInfo("formatingCell"); })
)
<script type="text/javascript">
function data() {
$.ajax({
url: "@(Url.Action("UseShippingAddress", "Grid"))",
type: "POST",
data: { id: 50 },
cache: false,
async: true,
success: function (data) {
var Obj = $("#Grid").ejGrid("instance");
Obj.dataSource(ej.parseJSON(data));
}
});
};
</script> |