<ej-button id="btn" click="updatecolumn" text="Apply" />
<ej-percentage-text-box id="percentage" value="75" />
<ej-grid id="OrdersView" allow-scrolling="true" datasource="ViewBag.datasource">
<e-columns>
<e-column field="OrderID" header-text="Order ID" width="80"></e-column>
<e-column field="CustomerID" header-text="Customer ID" width="80"></e-column>
<e-column field="EmployeeID" header-text="Employee ID" width="80"></e-column>
<e-column field="Freight" header-text="Freight" format="{0:N}" width="80"></e-column>
</e-columns>
</ej-grid>
<script type="text/javascript">
function updatecolumn(args) {
var gridobj = $("#OrdersView").ejGrid("instance");
var rows = gridobj.getRows();
var value = $("#percentage").ejPercentageTextbox("getValue");
var colindex = gridobj.getColumnIndexByField("Freight");
for (var i = 0; i < rows.length; i++) {
gridobj.setCellText(i, colindex, value/100);
}
}
</script> |