Hi Christian ,
Thanks for contacting Syncfusion support.
Query 1: 1- How do I update a particular column of the grid based on an external ajax request? The updateCell method kind of does that, but it also records that as a cell change which needs to be update/pushed to the server, and I don't want that.
We have suspect that , you want to update the particular cell value in client side only. We have suggest to use, ‘setCellValue’ method. The ‘setCellValue’ is updated only client and it is not affecting the Grid dataSource (but when you preforming Grid Sorting, searching , filtering , editing , etc., based on its dataSource original value i.e., if you have changed cell value by setCellValue is not the change affected while performing the Grid action ) Please find the documentation and code example for your reference.
code example:
grid.setCellValue(10251, 'CustomerID', 'HANAR');
|
Query 2: How do I modify the style (change color) of a particular cell on the grid also based on the information received from an ajax request after the grid has been rendered.
Yes, you can apply the cell customized after Grid rendered by the following way.
<style>
.e-grid .e-rowcell.e-custom{
color:red;
}
</style>
function cellCustomized(e){
var gridRows = grid.getRowsObject();
var pkKey = grid.getPrimaryKeyFieldNames()[0];
for(let i =0; i< gridRows.length; i++){
if(gridRows[i].data[pkKey] == 10250){
var colIndex = grid.getColumnByField('Freight').index;
grid.getRows()[i].children[colIndex].classList.add('e-custom')
}
}
We can find the exact row by using ‘primarykey’ column by through ‘getRowsObject()’ method and found the cell element through ‘gridRows()’ method and applied the custom class for the cell element.
Please find the API documentation for your reference.
Regards,
J Mohammed Farook