Hi,
In my grid, I have added a column and set the EditType to "numericedit". Now I want to customize the spin up and down icons in the cell. I want to do one of the following:
Is this possible?
|
Index.cshtml
<div class="control-section">
@Html.EJS().Grid("DefaultPaging").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").Width("120").IsPrimaryKey(true).Filter(new { type = "CheckBox" }).TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("CustomerID").HeaderText("Customer Name").Width("170").Add();
col.Field("OrderDate").HeaderText("Order Date").Width("130").EditType("datepickeredit").Format("yMd").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("Freight").HeaderText("Freight").Width("120").Edit(new { create = "create", read = "read", destroy = "destroy", write = "write" }).Format("C2").TextAlign(Syncfusion.EJ2.Grids.TextAlign.Right).Add();
col.Field("ShipCountry").EditType("dropdownedit").HeaderText("Ship Country").Width("150").Add();
}).Height("400").AllowPaging().Toolbar(new List<string>
() { "Add", "Edit", "Delete", "Update", "Cancel" }).AllowFiltering().FilterSettings(filter => filter.Type(Syncfusion.EJ2.Grids.FilterType.Menu)).EditSettings(edit => { edit.AllowEditing(true).AllowAdding(true).AllowDeleting(true); }).Render()
</div>
<script>
var elem;
var nObj;
function create(args) {
elem = document.createElement('input');
return elem;
}
function write(args) {
nObj = new ej.inputs.NumericTextBox({
format: 'c2',
created: function () {
var span = document.createElement("span");
this.inputWrapper.container.append(span);
this.spinDown.className = this.spinDown.className + " " + "e-icons e-circle-remove";
this.spinUp.className = this.spinUp.className + " " + "e-icons e-circle-add";
span.append(this.spinUp);
span.append(this.spinDown);
},
value: args.rowData[args.column.field],
});
nObj.appendTo(elem);
}
function destroy() {
nObj.destroy();
}
function read(args) {
return nObj.value;
}
</script>
<style>
.content-wrapper {
width: 35%;
margin: 0 auto;
min-width: 185px;
}
.e-float-input.e-numeric.e-input-group {
margin-top: 40px;
}
.control-label {
padding: 24px 0px 10px 0px;
font-size: 12px;
}
.e-input-group .e-input-group-icon, .e-input-group.e-control-wrapper .e-input-group-icon {
margin-bottom: 0px;
margin-right: 0px;
margin-top: 0px;
}
</style> |