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

Make close and select of class grids work.

parent ecc28a04
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -78,6 +78,11 @@ Ext.define('Docs.controller.Classes', {
                    this.loadClass(cls);
                }
            },
            'classgrid': {
                classselect: function(cls) {
                    this.loadClass(cls);
                }
            },

            'indexcontainer': {
                afterrender: function(cmp) {
+25 −2
Original line number Diff line number Diff line
@@ -15,6 +15,21 @@ Ext.define('Docs.view.ClassGrid', {
    icons: {},

    initComponent: function() {
        this.addEvents(
            /**
             * @event classselect
             * Fired when class in grid selected.
             * @param {String} name  Name of the class that was selected. For example "Ext.Ajax".
             */
            "classselect",
            /**
             * @event closeclick
             * Fired when close button in grid clicked.
             * @param {String} name  Name of the class that was closed. For example "Ext.Ajax".
             */
            "closeclick"
        );

        this.columns = [
            {
                width: 18,
@@ -32,11 +47,19 @@ Ext.define('Docs.view.ClassGrid', {
                xtype: 'actioncolumn',
                width: 18,
                icon: 'resources/images/x12.png',
                tooltip: 'Delete'
                tooltip: 'Delete',
                handler: function(view, rowIndex) {
                    this.fireEvent("closeclick", this.getStore().getAt(rowIndex).get("cls"));
                },
                scope: this
            }
        ];

        this.callParent(arguments);

        this.getSelectionModel().on("select", function(sm, r) {
            this.fireEvent("classselect", r.get("cls"));
        }, this);
    }

});
+13 −2
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ Ext.define('Docs.view.Viewport', {
        'Docs.view.index.Container',
        'Docs.view.tree.Tree',
        'Docs.view.ClassGrid',
        'Docs.Favorites',
        'Docs.History'
    ],

@@ -88,13 +89,23 @@ Ext.define('Docs.view.Viewport', {
                                xtype: 'classgrid',
                                title: 'Favorites',
                                store: Ext.getStore('Favorites'),
                                icons: Docs.icons
                                icons: Docs.icons,
                                listeners: {
                                    closeclick: function(cls) {
                                        Docs.Favorites.remove(cls);
                                    }
                                }
                            },
                            {
                                xtype: 'classgrid',
                                title: 'History',
                                store: Ext.getStore('History'),
                                icons: Docs.icons
                                icons: Docs.icons,
                                listeners: {
                                    closeclick: function(cls) {
                                        Docs.History.removeClass(cls);
                                    }
                                }
                            }
                        ]
                    },