Category Archives: ExtJS

ExtJs, komponente u toolbaru panela

dockedItems: [{
        xtype: 'toolbar',
        dock: 'bottom',
        items: [{
            text: 'Fokusiraj na Omišalj',
            handler: function () {
                var me = this,
                    panel = GeoExt.panel.Map.guess(),
                    map = panel.map;
                map.setCenter(new OpenLayers.LonLat(1617951, 5656077), 15);
                //map.zoomToExtent(panel.extent, true);
            }
        }, {
            text: 'Full screen',
            enableToggle: true,
            listeners: {
                click: function () {

                    var me = this,
                        map_panel = Ext.ComponentQuery.query('#main-map-panel')[0],
                        viewport_width = document.documentElement.clientWidth,
                        viewport_height = document.documentElement.clientHeight,
                        default_width = map_panel.default_width,
                        default_height = map_panel.default_height;

                    if (me.pressed == true) {
                        map_panel.setWidth(viewport_width);
                        map_panel.setHeight(viewport_height);
                        me.setText('Vrati na originalne dimenzije');
                        return;
                    }

                    map_panel.setWidth(default_width);
                    map_panel.setHeight(default_height);
                    me.setText('Full screen');
                }
            }
        }]
    }]