Skip to content

Instantly share code, notes, and snippets.

@edspencer
Created April 24, 2009 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edspencer/101411 to your computer and use it in GitHub Desktop.
Save edspencer/101411 to your computer and use it in GitHub Desktop.
Ext.onReady(function() {
//The panel we'll be adding our nav items to
var navGroup = new Ext.Panel({
region: 'west',
width: 180
});
//assuming this returns some JSON like {response: [{title: 'My Nav Item', html: 'some text'}, {title: 'Another item', html: 'test'}]}
var store = new Ext.data.JsonStore({
url: '<?= RELATIVE_PATH ?>/Nav/View',
root: 'response',
fields: ['id', 'name']
});
store.load({
//this gets called as soon as the store has finished loading
callback: function(records) {
//create a panel for each record, add each to navGroup
Ext.each(records, function(record) {
navGroup.add(new Ext.Panel(record));
}, this);
//force navGroup to make sure its child panels are rendered properly
navGroup.doLayout();
}
});
var viewport = new Ext.Viewport({
layout: 'border',
items: [
... your other panels, one of which must have "region: 'center'",
navGroup
]
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment