Hi all
I'm using a Store with a Json reader to get some data from the backend. Everything works fine but I get an error when some of this data has a null value.
Here's my data
PHP Code:
{"licences":[{"Id":2,"LicenseKey":"123456","Point":null,"Owner":{"Id":1,"Name":"Witbit"}, "Mac":null,"Active":false},
{"Id":3,"LicenseKey":"789013","Point":null,"Owner":null, "Mac":null,"Active":false}]}
and corresponding reader:
PHP Code:
this.DS = new Ext.data.Store(
{
reader: new Ext.data.JsonReader(
{
root: "licences",
fields: [ "Id", "LicenseKey", {name:"Owner_Name", mapping:"Owner.Name"}, "Point", "Mac", "Active" ]
})
});
When I load the data I get an error because the second license object has no owner (=null) and thus Owner.Name is not an object.
I already found a way to make my app work but I wonder if there's way to handle data with null value...for example the reader should check if an object is null before trying to parse its members?
Thanks in advance