BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
$("#Grid").ejGrid({ dataSource: data, allowPaging: true, allowSorting: true, columns: [ { field: "OrderID", headerText: "Order ID", width: 75 , textAlign: ej.TextAlign.Right }, { field: "CustomerID", headerText: "Customer ID", width: 80 }, { field: "EmployeeID", headerText: "Employee ID", width: 75, textAlign: ej.TextAlign.Right }, { field: "Freight", width: 75, format: "{0:C}", textAlign: ej.TextAlign.Right }, { field: "OrderDate", headerText: "Order Date", width: 80, format: "{0:MM/dd/yyyy}", textAlign: ej.TextAlign.Right }, { field: "ShipCity", headerText: "Ship City", width: 110 } ], rowDataBound: function (args) { if (args.data["OrderID"] == "10250") { args.data["CustomerID"] = "abcdefg"; //change value to the datasource $(args.row).find('td').eq(1).text("abcdefg"); //change value to the cell } } |
function refreshGrid() { var model = $("#Grid").ejGrid("model"); for (var i = 0; i < model.dataSource.length; i++) { setCellVal(i, "unitPrice", Math.floor(Math.random() * 50 + 1)); setCellVal(i, "unitsInStock", Math.floor(Math.random() * 100)); setCellVal(i, "unitsOnOrder", Math.floor(Math.random() * 5) * 10); } } //index- row index, fieldName- column field name, cellValue - need to set value to the cell function setCellVal(index, fieldName, cellValue) { obj = $('#Grid').ejGrid('instance'); var tr = $(obj.getRows()[index]); //get row index var data = obj.model.currentViewData[index]; //get data from currentjson data data[fieldName] = cellValue; //assign value to datasource columnIndex = obj.getColumnIndexByField(fieldName); //get column index var $element = $(tr).find('td').eq(columnIndex); $element.text(cellValue); //set value to the cell
//apply background color to the cell if (fieldName === "unitPrice") { if (Globalize.parseFloat(Globalize.format($element.text(), "c")) < 30) { $element.css("background-color", "#b0e98f").css("color", "black"); } else { $element.css("background-color", "#f4a496").css("color", "black");
} } |