ExtJs Ext.PagingToolbar:隐藏或设置刷新按钮onclick的参数?

发布于 2025-01-05 04:56:45 字数 1435 浏览 2 评论 0原文

刷新按钮没有自定义设置,因此我尝试隐藏/删除它。 hideRefresh: true 对我不起作用。

如果没有办法隐藏它,我至少可以在单击按钮时传递一些参数,这样我就可以让它执行一些有意义的任务吗?

pPanel = new Ext.Panel({
    applyTo: 'newProgWin',
    autoScroll:true,
    styleClass: 'formInput',
    bodyStyle: 'overflow-x: hidden',
    align: 'center',
    layout:'fit',
    width:899,
    height:450,
    closeAction:'hide',
    plain: true,
    items: winDataView = new Ext.DataView({
        tpl: resultTpl,
        store: npDs,
       itemSelector: 'div.search-item'
    }),

    tbar: [
                'Search: ', ' ',
            (winSearchField = new Ext.ux.form.SearchField({
                store: npDs,
                width:300
            }))
        ],
    bbar: new Ext.PagingToolbar({
                beforeLoad : function()
                {
                    pocProxy.extraParams = {
                        eps: currentProgs,
                        stateful: true,
                        dataCall: dataCallId,
                        orgNameConvention: currentOnc,
                        installation: currentInstallation
                    };
                },   
                store: npDs,
                pageSize: pageSize,
                displayInfo: true,
               //hideRefresh: true,
                displayMsg: 'Organizations {0} - {1} of {2}',
                emptyMsg: "No Organizations available to display"

            })
});

No customized setup for the refresh button, so I am trying to hide/remove it.
hideRefresh: true didn't work for me.

If there is no way to hide it, can I at least pass some parameters when the button is clicked, so I can make it do some meaningful tasks?

pPanel = new Ext.Panel({
    applyTo: 'newProgWin',
    autoScroll:true,
    styleClass: 'formInput',
    bodyStyle: 'overflow-x: hidden',
    align: 'center',
    layout:'fit',
    width:899,
    height:450,
    closeAction:'hide',
    plain: true,
    items: winDataView = new Ext.DataView({
        tpl: resultTpl,
        store: npDs,
       itemSelector: 'div.search-item'
    }),

    tbar: [
                'Search: ', ' ',
            (winSearchField = new Ext.ux.form.SearchField({
                store: npDs,
                width:300
            }))
        ],
    bbar: new Ext.PagingToolbar({
                beforeLoad : function()
                {
                    pocProxy.extraParams = {
                        eps: currentProgs,
                        stateful: true,
                        dataCall: dataCallId,
                        orgNameConvention: currentOnc,
                        installation: currentInstallation
                    };
                },   
                store: npDs,
                pageSize: pageSize,
                displayInfo: true,
               //hideRefresh: true,
                displayMsg: 'Organizations {0} - {1} of {2}',
                emptyMsg: "No Organizations available to display"

            })
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

帅气称霸 2025-01-12 04:56:45

Ext.PagingToolbar 中没有 hideRefresh 属性。

您可以通过 bbar(Ext.PagingToolbar 实例)对象访问刷新按钮。

pPanel.bbar.refresh

您可以使用hide() 函数隐藏它。

pPanel.bbar.refresh.hide()

您还可以将其隐藏在 Ext.PagingToolbar 的 afterrender 事件中:

listeners: {
    afterrender: function() {
        this.refresh.hide();
    }
}

您可以通过重写来修改刷新按钮的行为bbar 中的 doRefresh 函数

pPanel.bbar.doRefresh

关于您的代码,覆盖 beforeLoad 函数并不是一个好主意除非是故意的,否则你会修改内部结构。也许将其移动到商店对象?

请务必查看文档及其代码,因为这将有助于您进行调试。 ;)

There isn't a property for hideRefresh in the Ext.PagingToolbar.

You can access the refresh button via the bbar (the Ext.PagingToolbar instance) object.

pPanel.bbar.refresh

You can hide it using the hide() function.

pPanel.bbar.refresh.hide()

You can also hide it in your afterrender event in your Ext.PagingToolbar:

listeners: {
    afterrender: function() {
        this.refresh.hide();
    }
}

You can modify the behavior of the refresh button by overriding the doRefresh function in the bbar

pPanel.bbar.doRefresh

Regarding your code, it's not a good idea to overriding the beforeLoad function you'll be tinkering with the innards unless its intentional. Maybe moving it to the store object instead?

Make sure you check out the documentation and its code as well because that would help you with debugging. ;)

北方的韩爷 2025-01-12 04:56:45

这段代码对我来说工作正常:

this.bbar = Ext.create('Ext.PagingToolbar', {
            store: 'Interactions',
            displayInfo: false,
            preprendButtons: false,
           listeners: {
                afterrender : function() {
                    this.child('#refresh').hide();
                }
            }
        });

This code working fine for me:

this.bbar = Ext.create('Ext.PagingToolbar', {
            store: 'Interactions',
            displayInfo: false,
            preprendButtons: false,
           listeners: {
                afterrender : function() {
                    this.child('#refresh').hide();
                }
            }
        });
鸠书 2025-01-12 04:56:45
 listeners:{
    afterrender:function(){
        var a = Ext.query("button[data-qtip=Refresh]"); 
        for(var x=0;x < a.length;x++)
        {
            a[x].style.display="none";
        }
    }
}
 listeners:{
    afterrender:function(){
        var a = Ext.query("button[data-qtip=Refresh]"); 
        for(var x=0;x < a.length;x++)
        {
            a[x].style.display="none";
        }
    }
}
嘿哥们儿 2025-01-12 04:56:45

在 ExtJs 6.2 中我必须使用以下代码:

var toolbar = this.lookupReference('pagingtoolbar');      
toolbar.on('afterrender', function () {
    this.getComponent('refresh').hide();
});

In ExtJs 6.2 I had to use this code:

var toolbar = this.lookupReference('pagingtoolbar');      
toolbar.on('afterrender', function () {
    this.getComponent('refresh').hide();
});
再浓的妆也掩不了殇 2025-01-12 04:56:45

至少在 ExtJS 6.5.2(经典)中,您可以按如下方式重写刷新操作:

bbar: {
    xtype: 'pagingtoolbar',
    doRefresh: function () {
        console.log('Overriding refresh action');
        Ext.getStore('myStore').load({
            params: { // add custom params to existing params
                customParam: 'customValue'
            }
        });
        return false; // cancel load
    }
}

In ExtJS 6.5.2 at least (classic), you can override the refresh action as follows:

bbar: {
    xtype: 'pagingtoolbar',
    doRefresh: function () {
        console.log('Overriding refresh action');
        Ext.getStore('myStore').load({
            params: { // add custom params to existing params
                customParam: 'customValue'
            }
        });
        return false; // cancel load
    }
}
罪歌 2025-01-12 04:56:45

您可以为分页工具栏提供一些较小的宽度,以便隐藏刷新组件:P

you can give some smaller width to pagination toolbar so that the refresh component gets hidden :P

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文