@Html.EJS().Toolbar("defaultToolbar").Created("created").Items(new List<ToolbarItem> {
…
new ToolbarItem { Text = "Input", Template= "<input id='numeric' type='text'/>" }, // Element
}).Render()
<script>
function created() {
var numeric = new ej.inputs.NumericTextBox({
format: 'c2',
value: 1,
width: 150
});
numeric.appendTo('#numeric'); // Render numeric text box
}
</script> |
@{
List<object> toolbarItems = new List<object>();
toolbarItems.Add(new
{
id = "template",
text = "Input",
template = "<input id='numeric' type='text'/>"
});
}
@Html.EJS().Grid("Grid").Created("created").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>
{
col.Type("checkbox").Width("50").Add();
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).Width("120").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
. . . .
col.Field("ShipName").HeaderText("Ship Name").Width("150").Add();
}).AllowResizing().ToolbarClick("toolbarClick").Toolbar(toolbarItems).AllowPaging().PageSettings(page => page.PageCount(5)).EditSettings(edit => {edit.AllowEditing(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).
Render()
<script>
function toolbarClick(args) {
if (args.item.id === 'template') {
alert("template");
}
}
</script>
<script>
function created() {
var numeric = new ej.inputs.NumericTextBox({
format: 'c2',
value: 1,
width: 150
});
numeric.appendTo('#numeric'); // Render numeric text box
}
</script> |