Created
April 24, 2009 23:55
-
-
Save edspencer/101411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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