Show cool things you have done with our products


Post by VijaySM »

I want to load all store data from already available JSON data, how can I?
and whenever require I will call method with data and it will populate my data to Ext Gnt.

Post by VijaySM »

Tried below code but showing screen with no data.
I have same Json Data as we receive from read.php.
var taskStore = new Gnt.data.TaskStore({
    root : {
        Id : 1,
        Name : 'root',
        children : data
    }
});

Post by mats »

A flat store can have a 'data' property which is an array of row data

A tree store can have a 'root' configured on the TaskStore, with 'children' being the array

Recommended reading:

https://docs.sencha.com/extjs/6.0/6.0.0- ... .TreeStore
https://docs.sencha.com/extjs/6.0/6.0.0- ... data.Store

Post by mats »

Is 'data' an array? If not, please read the docs for TreeStore + NodeInterface - it clearly shows you how to do it.

Post by VijaySM »

It's very kind support from you, thanks @Mats

Post by VijaySM »

Still not able to load data from an array. my code is as below.
var myObject = JSON.parse('Response from read.php');
var treeStore = Ext.create("Ext.data.TreeStore", {
    autoLoad: true,
    data: [
        myObject
    ]
});
Last edited by VijaySM on Tue Apr 05, 2016 1:30 pm, edited 1 time in total.

Post by mats »

Please use CODE tags when posting CODE. What is myObject? Did you read the docs carefully?

Post by VijaySM »

myObject hold static data same as response from read.php, I have gone through the docs but didn't find relevant code.

Post by mats »

So, what JS type is myObject? String? Object? Array?

Post by VijaySM »

It's string and I parse to Array using JSON.parse.
Last edited by VijaySM on Tue Apr 05, 2016 1:38 pm, edited 2 times in total.

Post Reply