Extjs pagingtoolbar如何居中显示消息

时间:2012-07-18 22:03:57

标签: extjs extjs4

在ext分页工具栏中,有一种方法可以使显示消息居中

            xtype: 'pagingtoolbar',
            height: 26,
            width: 360,
            displayInfo: true,
            displayMsg: '{0} - {1} of {2}',
            border: false,
            store: 'myStore'
            dock: 'bottom'

我想将displayMsg居中,但我不知道如何。

1 个答案:

答案 0 :(得分:1)

默认情况下,当displayInfo为true时,分页工具栏会添加一个tbfill元素。要使文本居中,您可以在最后添加另一个tbfill。

grid.down('pagingtoolbar').add({xtype:'tbfill'});

这会将文本居中放在工具栏的空白部分,如果你想将它放在整个工具栏的中心,我认为你需要计算第一个tbfill的宽度,然后设置它。