Permalink
Browse files

Made default item selected optional

Made default item selected optional defining "selected: true" in the
item list
  • Loading branch information...
1 parent 8cb29f4 commit e756829cb55b23862140bbb9f235b89d7e789de3 @acasaccia acasaccia committed Feb 27, 2013
Showing with 10 additions and 4 deletions.
  1. +10 −4 ux/slidenavigation/View.js
View
@@ -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;
@@ -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

0 comments on commit e756829

Please sign in to comment.