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

Fix error when selecting classes in history tab.

parent e427ef7c
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -60,6 +60,11 @@ Ext.define('Docs.view.ClassGrid', {
        this.getSelectionModel().on("select", function(sm, r) {
            this.fireEvent("classselect", r.get("cls"));
        }, this);

        // Initialize selection after rendering
        this.on("afterrender", function() {
            this.selectClass(this.selectedClass);
        }, this);
    },

    /**
@@ -68,12 +73,17 @@ Ext.define('Docs.view.ClassGrid', {
     * @param {String} cls  class name.
     */
    selectClass: function(cls) {
        this.selectedClass = cls;
        // when grid hasn't been rendered yet, trying to select will give us error.
        if (this.rendered) {
            var index = this.getStore().findExact('cls', cls);
            var sm = this.getSelectionModel();
            if (index > -1) {
            this.getSelectionModel().select(index, false, true);
                sm.select(index, false, true);
            }
            else {
            this.getSelectionModel().deselectAll(true);
                sm.deselectAll(true);
            }
        }
    }