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
70
Problem with nullable bool in igGrid
posted

Hi,

I have a igGrid with a nullable boolean (bool? in C#) in a column. When the value is "null", the field shows "false". And if I try to filter for "null" value the grid no return rows (if I filter with false, the grid shows the rows with "null" values in the nullable bool column).

Thank you!

Parents
  • 17590
    Offline posted

    Hello Sergio,

    Thank you for posting in our community.

    What I can suggest is setting localScehaTransform option to false. If set to false, the data to which the grid is bound will be used "as is" with no additional transformation, which I believe is the reason why null values are converted to false. For example:

    $("#grid").igGrid({
            dataSource: data,
            autoGenerateColumns: false,
            dataType: "JSON",
            width: "97%",
            responseDataKey: "results",
            primaryKey: "Id",
    		localSchemaTransform : false,
            autoCommit: true,
            columns: [
                { headerText: "BrandCode", key: "BrandCode", dataType: "string", hidden: false },
                { headerText: "Brand", key: "BrandName", dataType: "string", hidden: false },
    			{ headerText: "Is Active", key: "IsActive", dataType: "bool" }
            ],
            features: [
                {
                    name: "Filtering",
                    type: "local",
        			 showNullConditions : true,
                    columnSettings: [
                        { columnKey: "Stage", allowFiltering: false },
                        { columnKey: "Save", allowFiltering: false }
                    ]
                }
            ],
        });

    Attached you will find a small sample where I have a record with null value and when the grid is filtered by null the record is correctly displayed in the results.

    Please have a look at this sample and let me know if you need any further assistance with this matter.

    igGridNullValues.zip

Reply Children