Hi,
I’ve included dhtmlxgrid_json.js file in my page to be able to use json parsing, but I’ve an issue that I don’t know how to address.
When my cell data contains null values a JS error is thrown.
This happens because your JS contains this code
dhtmlXGridObject.prototype._process_json_row = function(r, data)
{
…
for (var i = 0; i < data.data.length; i++)
if (typeof data.data[i] == “object”)
{
r.childNodes[i]._attrs = data.data[i];
if (data.data[i].type)
r.childNodes[i]._cellType = data.data[i].type;
data.data[i] = data.data[i].value;
};
…
}
And line “if (data.data[i].type)” throws an exception because data.data[i] is null.
My question simply is why shouldn’t I be able to use null values?
Hi,
I feared that you would have answered me that.
For me it is wrong: json (the standard protocol) manages without problems null value, so I should be able to receive a javascript structure like [“xxx”, “yyy”, null, “zzz”].
Moreover, using an empty string instead of a null value is not very nice when working with columns that manage types different than string. For example I’ve a column (custom) that manages integers. For me the json value received by cells of that column should be a numeric value or a null value, not an empty string.
I think I’ll change my version of your json file to manage null values, but I hope you’ll think about this problem, because, imho, there is a conceptual error.
The problem is - grid was originally build around xml datasources, where string values was the only possible data type. So while json provides more rich set of data types - parsing engine still process them all as string, to maintain full compatibility between xml and json data loading capabilities.
Also, the next version of json extension will contain check for null value, so it will be processed correctly.
I am having the same problem. It seems that much of your json functionality is not truly json, but a patchwork attempt. There is also much lacking in supporting json in most of your other controls. This is frustrating to developers that are moving away from the quirky XML Data, to a more stable and robust data transfer found in json.
pirobox or DHX Support … can you please post the change ( quick patch) that we need to make to the json or other files so we can get past this issue in a timely manner.
Thanks
Rich
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan