<input id="filter" type="text"></input>
@Html.EJ().Button("ClickMe").Text("Change Content").ClientSideEvents(e => e.Click("btnClick"))
@(Html.EJ().Grid<EmployeeView>("GridSample1") . . . .AllowFiltering() .FilterSettings(filter => { filter.FilterType(FilterType.Excel); }) .ToolbarSettings(toolbar => { . . . . . }) .Columns(col => { col.Field("OrderID").IsPrimaryKey(true).Add(); . . .. . . col.Field("EmployeeID").HeaderText("EmployeeID").Width(100).Add(); }) ) <script> function btnClick(args) { var val = $("#filter").val(); if (val == "") return; var obj = $("#GridSample1").ejGrid("instance"); if (typeof val == "string" && $.isNumeric(val)) { val = parseFloat(val); } for (var i = 0; i < obj.model.currentViewData.length; i++) { obj.setCellValue(i, "EmployeeID", val)//updating each cell of employeeID column } |
@(Html.EJ().Grid<EmployeeView>("GridSample1") .AllowPaging() .Datasource(ds => ds.URL("/Home/DataSource").BatchURL("BatchUpdate").Adaptor(AdaptorType.UrlAdaptor)) .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch); }) .AllowFiltering() .FilterSettings(filter => { filter.FilterType(FilterType.Excel); }) .ToolbarSettings(toolbar => { . .. . . }) .Columns(col => { col.Field("OrderID").IsPrimaryKey(true).Add(); .. . . col.Field("Freight").HeaderText("Freight").EditTemplate(a => { a.Create("create").Read("read").Write("write"); }).Add(); }) ) <script> function create() { return $("<input>");//creating a textarea }
function write(args) {//Writing the edited text value args.element.ejPercentageTextbox({ value: args.rowdata["Freight"], minValue: 0, decimalPlaces: 2, incrementStep: 1 }) }
function read(args) { return args.ejPercentageTextbox('getValue'); //Getting the Edited text value } </script> |