Skip to content

Commit

Permalink
Made default item selected optional
Browse files Browse the repository at this point in the history
Made default item selected optional defining "selected: true" in the
item list
  • Loading branch information
Andrea Casaccia committed Feb 27, 2013
1 parent 8cb29f4 commit e756829
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ux/slidenavigation/View.js
Expand Up @@ -273,9 +273,15 @@ Ext.define('Ext.ux.slidenavigation.View', {

this.createContainerCSS();

// TODO: Make this optional, perhaps by defining
// "selected: true" in the items list
this.list.select(0);
var selectedItemIndex = 0;

Ext.each(this.list.getStore().getRange(), function(item, index) {
if (item.get('selected') === true) {
selectedItemIndex = index;
}
});

this.list.select(selectedItemIndex);

this.__init = true;

Expand Down Expand Up @@ -547,7 +553,7 @@ Ext.define('Ext.ux.slidenavigation.View', {
config: {
idProperty: 'index',
fields: [
'index', 'title', 'group',
'index', 'title', 'group', 'selected',
{
name: 'order',
defaultValue: 1
Expand Down

0 comments on commit e756829

Please sign in to comment.