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!
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
Hi Vasya,
When the grid is filtered by "false" the grid shows the "null" record.
What do implications have "localSchemaTransform: false"?
Hello Sergino,
When localScemaTransform is set to 'false' there is no additional transformation of data types on the client, that is, data is assumed to come in the correct format. In this scenario the row object contains all the defined fields in the original data source. Basically, the implications are that all features that operate on data like Sorting, Filtering, Group By will use the data "as is" without any additional transformations.
In regards to the filtering with "false" condition, this is expected behavior. By design, filtering with condition "false" on Boolean columns will return also the rows with null values.
Please let me know if you need any further assistance with this matter.
Which transformations (apart from null bool in false) does the igGrid make?
Another thing, affected by setting localSchemaTransform property to false, is date formatting. More about date handling and what formatting is applied can be found in this topic.
Please have a look at this topic in our documentation and let me know if you have any additional `questions regarding this matter.