Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Changing checkbox column value based on another column value
posted

Hi ,

I have two column in the iggrid.  One of the columns has datatype bool. ie it has checkbox. Checkbox column value doent come from database. I want to check the checkbox based on another column. Please help me to do this. 

I tried using template. But it is returning string value in the column. if i return true, It is displaying as true in the column instead of checking the check box.

Is there anyway to do this?

Parents
No Data
Reply
  • 17590
    Offline posted
    Hello pughalveni,
    Thank you for posting in our community. What I can suggest for achieving your requirement is using formula option of igGrid. This is a reference or name of a java script function which will calculate the value based on other cell values in the same row when column is bound. For example:
    $(function () {
                $("#grid").igGrid({
                    renderCheckboxes: true,
                    primaryKey: "ProductID",
                    columns: [
                        { headerText: "Product ID", key: "ProductID", dataType: "number" },
                        { headerText: "Product Name", key: "Name", dataType: "string" },
                        { headerText: "Product Number", key: "ProductNumber", dataType: "string" },
                        {headerText: "Is Active", key: "IsActive", unbound: true, dataType: "bool",
                        formula: function (dataRec, grid) {
                            return (dataRec.ProductID > 100) ? true : false;
                        }
                        }
                    ],
                    width: "500px",
                    dataSource: products
                });
            });
    
    I am also attaching a small sample for your reference. Please let me know if you need any further assistance with this matter.
    igGridFormatter.zip
Children
No Data