shinobukawano / Ext.ux.AccordionList

Accordion List Component for Sencha Touch 2
http://kawanoshinobu.com/public/demo/accordionlist/
50 stars 28 forks source link

AccordionList doesn't show when loaded from JSON #2

Closed MickWijnands closed 11 years ago

MickWijnands commented 11 years ago

Hey kawanoshinobu.

Have you ever tried to fill the treestore with a json file. I'm trying this and even though the store is filled, the results aren't showed. I have compared the stores from the example and mine and the only difference that I can find is this. http://www5.picturepush.com/photo/a/11463868/img/11463868.png So my question is: 'Have you tried filling the accordionlist via json. And what are tips or tricks to make it work'.

Thanks,

shinobukawano commented 11 years ago

Hi, MickWijnands

Sorry, My slow response.

Actually, I uses Ext.ux.AccordionList on my own products. And I've fill the treestore with a json file.

Code is like this:

Ext.Ajax.request({
  ...
  success: this.handleResponse,
});

...

handleResponse: function(res, opts) {
...
var store = Ext.create('Ext.data.TreeStore', {
    defaultRootProperty: 'items',
    model: 'XXX.model.Schedule',
    root: obj
});

list.setStore(store);

...
}

If you are not in a hurry, I create sample app with json in a few days.

MickWijnands commented 11 years ago

I would like an sample app. I'm struggling with this problem for a while now. Looking forward to it.

Thank you

shinobukawano commented 11 years ago

Hello, MickWijnands

Sorry, I finally found that AccordionList doesn't work with json proxy. And for now, I have no idea to fix it..

In my project, I use AccordionList like this.

Ext.Ajax.request({
  ...
  success: this.handleResponse,
});

...

handleResponse: function(res, opts) {
...
    var obj = Ext.JSON.decode(res.responseText);
    ...
    var store = Ext.create('Ext.data.TreeStore', {
        defaultRootProperty: 'items',
        model: 'XXX.model.Schedule',
        root: obj
    });

    list.setStore(store);
...
}    

I ask you to implement code to avoid problem..

MickWijnands commented 11 years ago

I got it working based on your example of yesterday. It works great and I'm happy that I finally got it to work. I want to thank you for your help.

shinobukawano commented 11 years ago

Wow! I'm also happy ;)

BAvila commented 11 years ago

MickWijnands,

I am facing the same issue. I have implemented my prior work using proxy to a jason file. Is there any way you could upload your solution to this problem.

Thanks

MickWijnands commented 11 years ago

BAvila,

What don't you understand. The example kawanoshinobu has provided contains everything you need. First you load the data with an Ajax request. At the success function you decode the response of the request and set this as the root for your store. Finally you set the store to the (accordion)list you're using.

BAvila commented 11 years ago

I would like to know how does he execute the headerItemTpl on the AccordionList.js. where is it called from ? or how is it access... thanks.