BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging() /*Paging Enabled*/
.SelectionType(SelectionType.Single)
.AllowResizing()
.ClientSideEvents(eve => { eve.ActionComplete("actionbegin"); })
.AllowFiltering()
.EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
});
})
.ClientSideEvents(e => e.QueryCellInfo("actionComplete"))
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("CustomerID").HeaderText("Customer ID").EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).DataSource((IEnumerable<object>)ViewData["LocalDataSource"]).TextAlign(TextAlign.Right).Width(90).ValidationRules(v => v.AddRule("required", true)).Add();
col.Field("Freight").HeaderText("Freight").TextAlign(TextAlign.Right).Width(75).Format("{0:C}").Add();
col.Field("OrderDate").HeaderText("Order Date").Format("{0:dd/MM/yyyy}").TextAlign(TextAlign.Right).Width(80).Add();
col.Field("ShipCity").HeaderText("Ship City").Width(110).Add();
}))
<script>
var items = [{
text: "ALF",
value: "ALFKI"
}, {
text: "ANA",
value: "ANATR"
}, {
text: "ARO",
value: "AROUT"
},
{
text: "BON",
value: "BONAP"
}, {
text: "",
value: "BOTTM"
},
{
text: "ANT",
value: "ANTON"
}, {
text: "BER",
value: "BERGS"
},
];
function create() {
return $("<input>");
}
function write(args) {
args.element.ejDropDownList({ width: "100%", dataSource:items,fields: { text: "text", value: "value" }, enableSorting: true, value: args.rowdata !== undefined ? args.rowdata["CustomerID"] : "" });//dropdownlist
}
function read(args) {
return args.ejDropDownList("getValue");
}
</script>
|