EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: pams on September 12, 2019, 09:44:27 PM



Title: get error when create button in datagrid toolbar
Post by: pams on September 12, 2019, 09:44:27 PM
hi everyone..

how to overwrite refresh button in datagrid..?
i used code like this:

var pager = $('#dataObject').datagrid('getPager');    // get the pager of datagrid
pager.pagination({
    showRefresh:false,
    buttons:[{
        iconCls:'icon-reload',
        handler:function(){
            $('#find').searchbox('setValue','');
            reLoad();
        }
    }]
});

i combine my project with Inspinia Template.
and i get error:

Uncaught TypeError: Cannot read property 'panel' of undefined
    at Object.getPager (<anonymous>:11965:32)
    at r.fn.init.$.fn.datagrid (<anonymous>:11815:35)
    at <anonymous>:4:30
    at p (jquery-3.1.1.min.js:2)
    at Ia (jquery-3.1.1.min.js:3)
    at r.fn.init.append (jquery-3.1.1.min.js:3)
    at r.fn.init.<anonymous> (jquery-3.1.1.min.js:3)
    at S (jquery-3.1.1.min.js:3)
    at r.fn.init.html (jquery-3.1.1.min.js:3)
    at Object.success (action.js:84)

can i combine Inspinia template with easyui..?

thanks a lot.

*sorry for my bad english


Title: Re: get error when create button in datagrid toolbar
Post by: jarry on September 17, 2019, 02:01:31 AM
Override the $.fn.pagination.defaults.nav to rewrite the 'refresh' logic.
Code:
$(function(){
var pager = $('#dataObject').datagrid('getPager');    // get the pager of datagrid
pager.pagination({
nav: $.extend({}, $.fn.pagination.defaults.nav, {
refresh: {
iconCls: 'pagination-refresh',
handler: function(){
console.log('refresh')
}
}
})
});
})


Title: Re: get error when create button in datagrid toolbar
Post by: pams on September 22, 2019, 06:11:39 PM
Thanks a lot Jarry.... it's work.