2

我有 PagingToolbar 作为我的网格的 bbar。当工具提示出现时,它呈现在我的可见屏幕下方,这就是垂直滚动出现的原因,但是当它出现时,垂直滚动会占据视口的某个位置,因此自动水平滚动也会显示溢出工具提示。所以基本上我有2个问题。

  1. 垂直滚动显示整个视口,但带有 bbar 的网格仅在南部区域,并且网格本身已经垂直滚动。是否有某种配置来控制这种行为?

  2. 如何禁用 PagingToolbar 的工具提示我有以下代码不起作用(网格定义,删除无关)。

初始化组件:函数(){

        变我=这个;

        this.store = '开发计划';

var paging = Ext.create('Ext.PagingToolbar', {
            商店:this.store,
            显示信息:真,
            displayMsg: 'Wyświetlono wnioski {0} - {1} z {2}',
            emptyMsg: "Brak wniosków do wyświetlenia"
        });

        Ext.each(paging.items.items, function(btn) {
            if (btn.getXType() == 'button' && btn.tooltip != undefined) {
                Ext.QuickTips.unregister(btn.getId());
            }
        });

        this.bbar = 分页;

this.callParent(参数);

我认为上面的代码可能不起作用,因为尚未注册工具提示,或者因为尚未呈现分页工具栏,所以我尝试了:

渲染后:函数(){

        this.callParent();

        var items = this.bbar.items.items;
        ext.each(项目,功能(btn){
            if (btn.getXType() == 'button' && btn.tooltip != undefined) {
                控制台.log(btn.getId());
                Ext.QuickTips.unregister(btn.getId());
            }
        });
    }

但在这段代码中,我得到 this.bbar 是未定义的。为什么?那么bbar什么时候渲染呢?

4

2 回答 2

2

由于 ExtJS4,bbar 只是一种将工具栏/项目应用为底部停靠并在初始化后取消设置的简短方法,请参阅

if (me.bbar) {
    docked.push(initToolbar(me.bbar, 'bottom'));
    me.bbar = null;
}

我想你可以这样做(我希望这是一个事件,所以评论是):

afterrender: function(grid) { 
    // 'this' should not be accessible within a eventcallback! If it is you are within the class definition and should use this.on('beforerender', ...) after the callParent() instead!!
    // callParent() should be called within the init of the class, not somewhere else!
    // this.callParent(); 

    var pagebar = grid.down('pagingtoolbar'),
        items = pagebar ? pagebar.items.items : [],
        len = items.length,
        i = 0;
    // don't use each if it is not really necessary!
    for(;i < len; i++) {
        var item = items[i];
        if (item.getXType() === 'button' && item.tooltip != undefined) {
            console.log(item.getId());
            Ext.QuickTips.unregister(item.getId());
        }
    });
}

编辑:

根据您的最后一条评论:您不应该覆盖 Grid 的 afterRender 方法,而是将自己注册到 aftererender 事件,并在调用父级之后的 initComponent() 中执行此操作,如代码示例的评论中所写

编辑2:

每个按钮上都有一个私有方法可以清除工具提示。正如您可能知道的那样,私有方法仍然可以像其他任何方法一样被调用,但可以在即将发布的框架版本中完全更改/删除。它们中的大多数也无法在 API 中找到。您正在寻找的方法是clearTip()

在要从中删除工具提示的每个按钮实例上调用它。那应该行得通。

我完全监督了您的第一个问题:您应该考虑通过使用从视口中删除滚动行为,autoScroll: false或者通过使用从网格中禁用它viewConfig: { autoScroll: false, scroll: false }

于 2012-09-02T05:23:56.593 回答
0

你可以这样做

{
dock : 'bottom',
xtype : 'pagingtoolbar',
store : store,
pageSize : 25,
displayInfo : true,
firstText:null,
prevText:null,
nextText:null,
lastText:null,
refreshText:null,
....
于 2013-10-14T08:38:36.467 回答