json - How to store and recursively read ExtJS component like this? -
the layout below want implement in webpage. i'd store json-like file, question :
- how should store it, especially, lines of function stuff?strictly obeying json style, or else?
- after stored successfully, how set model?
- how can read ext.data.store recursively, or loop?
any suggestions appreciated. thanks.
{ 'xtype': 'tabpanel', 'activetab': 0, 'width': 600, 'height': 250, 'plain': true, 'defaults' :{ 'autoscroll': true, 'bodypadding': 10 }, 'items': [{ 'title': 'normal tab', 'html': "my content added during construction." },{ 'title': 'ajax tab 1', 'loader': { 'url': 'ajax1.htm', 'contenttype': 'html', 'loadmask': true }, 'listeners': { 'activate': function(tab) { tab.loader.load(); } } },{ 'title': 'ajax tab 2', 'loader': { 'url': 'ajax2.htm', 'contenttype': 'html', 'autoload': true, 'params': 'foo=123&bar=abc' } },{ 'title': 'event tab', 'listeners': { 'activate': function(tab){ settimeout(function() { alert(tab.title + ' activated.'); }, 1); } }, 'html': "i tab 4's content. have event listener attached." },{ 'title': 'disabled tab', 'disabled': true, 'html': "can't see me cause i'm disabled" } ] }
you have store functions strings , parse them later, same way sencha architect does.
this snippet created sencha architect
"implhandler": [ "settimeout(function(){", " alert(tab.title + ' activated'); ", "},1);" ] so have store code this
{ "xtype": "tabpanel", "activetab": 0, "width": 600, "height": 250, "plain": true, "defaults" : { "autoscroll": true, "bodypadding": 10 }, "items": [{ "title": "normal tab", "html": "my content added during construction." },{ "title": "ajax tab 1", "loader": { "url": "ajax1.htm", "contenttype": "html", "loadmask": true }, "listeners": { "activate": "function(tab) {tab.loader.load();}" } },{ "title": "ajax tab 2", "loader": { "url": "ajax2.htm", "contenttype": "html", "autoload": true, "params": "foo=123&bar=abc" } },{ "title": "event tab", "listeners": { "activate": "function(tab){settimeout(function() {alert(tab.title + ' activated.');}, 1);" } },{ "html" : "i tab 4's content. have event listener attached." },{ "title": "disabled tab", "disabled": true, "html": "can't see me cause i'm disabled" } ] } after need create model each field , create parser render component later.
i don't know trying do, seems lot of work.
Comments
Post a Comment