Please provide any example for conditional column template which highlights the iggrid's cell with background color.
http://jsfiddle.net/zLRRN/1/
$(function () { var columnSettings = [ { headerText: "Product Name", key: "ProductName" , template: "{{if ${ProductName} == 'Chai' }}one{{else}}two{{/if}}" } ]; $('#resultGrid').igGrid({ dataSource: northwindProducts, responseDataKey: "results", dataSourceType: "json", width: "100%", autoGenerateColumns: true, columns: columnSettings, features: [ { name: "Paging", type: "local", pageSize: 8 } ] }); });
Hello Renganathan,
Thank you for posting in our forum.
In the way that you are trying to set some style, directly in the columnSettings Template, you can set only for example the text color, not the cell background color too. You can set text color when wrap the cell content in a div element with specified style. If you set a background color to the div you will set the background color only for the div element, not for the entire cell. Here is the code that I use to set some text color within a cell:
If you want to set a cell background, based on a cell value, this is a different story. My suggestion is to handle igGrid pagerRendered event and in there to manage your requirements. For example in the code below you will see how I loop through all visible grid rows, get the cell value for the specific column and based on the cell value, apply some cell style.
Here you can find online sample implementing my suggestions, and also I am attaching you an html sample too.
http://jsfiddle.net/zLRRN/4/
Please have a look and if you have any further questions regarding this, do not hesitate to contact me.
Hi,
I am using .cshtml file so we need C#/Jquery vesrion for this HTML code
I need c# code for following code