Commit c3af490c authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Auto-select current class in hist/fav grid.

parent 49110ce3
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -34,6 +34,14 @@ Ext.define('Docs.controller.Classes', {
        {
            ref: 'tree',
            selector: 'classtree'
        },
        {
            ref: 'favoritesGrid',
            selector: '#favorites-grid'
        },
        {
            ref: 'historyGrid',
            selector: '#history-grid'
        }
    ],

@@ -190,6 +198,9 @@ Ext.define('Docs.controller.Classes', {
        }

        this.currentCls = cls;

        this.getFavoritesGrid().selectClass(cls.name);
        this.getHistoryGrid().selectClass(cls.name);
    },

    showGuide: function(name, noHistory) {
+15 −0
Original line number Diff line number Diff line
@@ -60,6 +60,21 @@ Ext.define('Docs.view.ClassGrid', {
        this.getSelectionModel().on("select", function(sm, r) {
            this.fireEvent("classselect", r.get("cls"));
        }, this);
    },

    /**
     * Selects class if grid contains such class.
     * Fires no events while selecting.
     * @param {String} cls  class name.
     */
    selectClass: function(cls) {
        var index = this.getStore().findExact('cls', cls);
        if (index > -1) {
            this.getSelectionModel().select(index, false, true);
        }
        else {
            this.getSelectionModel().deselectAll(true);
        }
    }

});
+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ Ext.define('Docs.view.Viewport', {
                        items: [
                            {
                                xtype: 'classgrid',
                                id: 'favorites-grid',
                                title: 'Favorites',
                                store: Ext.getStore('Favorites'),
                                icons: Docs.icons,
@@ -98,6 +99,7 @@ Ext.define('Docs.view.Viewport', {
                            },
                            {
                                xtype: 'classgrid',
                                id: 'history-grid',
                                title: 'History',
                                store: Ext.getStore('History'),
                                icons: Docs.icons,