Loading multiple grids from json with multiple roots
Is it possible to use a ListLoader and JSONReader to populate multiple grids from a multi-root json object? I'm attempting to load 3 grids -one for machines, one for mab and one for users - from the following JSON:
{
"machines" : [
{
"total" : "1",
"user" : "dtc2100cc1bbd6e",
"mac" : "00-21-cc-6d-b1-eb"
},
{
"total" : "1",
"user" : "dtc26009b242e86",
"mac" : "00-26-B9-8E-42-62"
}
],
"mabs" : [
{
"total" : "1",
"user" : "dtc2100cc1bbd6e",
"mac" : "00-21-cc-6d-b1-eb"
},
{
"total" : "1",
"user" : "dtc26009b242e86",
"mac" : "00-26-B9-8E-42-62"
}
],
"users" : [
{
"total" : "1",
"user" : "dtc2100cc1bbd6e",
"mac" : "00-21-cc-6d-b1-eb"
},
{
"total" : "1",
"user" : "dtc26009b242e86",
"mac" : "00-26-B9-8E-42-62"
}
]
}
I can easily extend JSONReader for each of the 3 roots, creating a MACJsonReader, MABJsonReader and UsersJsonReader but the ListLoader only accepts one reader.
Create your own LoadHandler
I ran into a similar issue a little while back and came up with a solution that should work for you.
The details can be found in this thread:
http://www.sencha.com/forum/showthread.php?248948-Can-the-GXT-JsonReader-(using-AutoBeans)-parse-complex-JSON-structures