css - 如果元素超过父宽度,ExtJS 4.0.7 如何换行

标签 css extjs

如果分辨率低,按钮元素会位于另一个面板后面。在 Firebug 中,它们是绝对定位的。有什么办法可以改变这种行为吗?我尝试了很多方法,但都没有用,非常感谢。

enter image description here

var scanBar =
  {
    xtype: 'panel',
    border: 0,
    height: 60,
    layout: {
      type: 'hbox',
      align: 'stretch'
    },
    items:
      [
        {
          xtype: 'panel',
          flex: 1,
          autoScroll: true,
          layout: {
            type: 'hbox',
            pack:'left',
            align:'middle'
          },
          items:
            [
              {
                xtype: 'button',
                margin: '0 0 0 10',
                width: 24,
                text: '',
                tooltip: 'Acercar vista',
                iconCls: 'zoom_in',
                handler: function (btn) {
                  zoom(1.25);
                }
              },
              {
                xtype: 'button',
                margin: '0 0 0 0',
                width: 24,
                text: '',
                tooltip: 'Alejar vista',
                iconCls: 'zoom_out',
                handler: function (btn) {
                  zoom(0.8);
                }
              },
              {
                xtype: 'button',
                margin: '0 0 0 0',
                width: 24,
                text: '',
                tooltip: 'Restablecer vista',
                iconCls: 'zoom_reset',
                handler: function (btn) {
                  resetZoom();
                }
              },
              {
                xtype: 'button',
                margin: '0 0 0 0',
                width: 24,
                text: '',
                tooltip: 'Ajustar a la ventana',
                iconCls: 'zoom_fit',
                handler: function (btn) {
                  autoZoom();
                }
              },
              {
                id: 'resetImgBtn',
                icon: 'images/reset.png',
                xtype: 'button',
                margin: '0 20 0 0',
                width: 200,
                text: 'Descartar',
                hidden: true,
                handler: function (btn) {
                  descartar();
                }
              },
              imgToolsBar,
              cbDocDestino,
              {
                id: 'scanImgBtn',
                icon: 'images/icono_scanner.png',
                xtype: 'button',
                margin: '0 20 0 20',
                width: 150,
                text: 'Escanear',
                disabled: true,
                handler: function (btn) {
                  escanear();
                }
              },
              {
                id: 'loadImgBtn',
                icon: 'images/icono_archivo.png',
                xtype: 'button',
                margin: '0 20 0 0',
                width: 150,
                text: 'Cargar desde Archivo',
                disabled: true,
                handler: function (btn) {
                  cargarimagen();
                }
              },
              {
                id: 'exchangeImgBtn',
                icon: 'images/icono_intercambiar.png',
                xtype: 'button',
                margin: '0 20 0 0',
                width: 150,
                text: 'Intercambiar',
                disabled: true,
                hidden: fnIntercambiarDeshabilitada,
                handler: function (btn) {
                  intercambiar();
                }
              },
              {
                id: 'cancelExchangeImgBtn',
                icon: 'images/icono_intercambiar.png',
                xtype: 'button',
                margin: '0 20 0 0',
                width: 150,
                text: 'CANCELAR',
                hidden: true,
                handler: function (btn) {
                  cancelarIntercambiar();
                }
              }
            ]
        },

WWith 布局:列 enter image description here

最佳答案

为此使用 layout: 'column' 而不是 hbox。

这会打破线条,但不会重新设置容器的高度,因此如果您不相应地设置主容器的高度,面板看起来就像消失了一样。

关于css - 如果元素超过父宽度,ExtJS 4.0.7 如何换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26535506/

相关文章:

javascript - Html + js +css 打包器

ExtJS 元素到组件

javascript - Sencha Ext 中的 float 图像

javascript - 选择链接时关闭 Bootstrap 菜单

php - 浏览器未呈现我的样式。难道我做错了什么?

javascript - extJS - 以编程方式添加新选项卡后无法在选项卡之间切换

json - 将 JSON 数组附加到现有的 Extjs 数据存储网格面板

php - 将每个单独的数组数据 block 包装在自己的 div 中

jquery - HTML 5 CSS 页脚堆叠

html - 想要更改标题链接 WordPress 上的悬停颜色