EasyUI Forum
April 25, 2024, 03:16:02 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: get error when create button in datagrid toolbar  (Read 2581 times)
pams
Newbie
*
Posts: 4


View Profile Email
« 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
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 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')
}
}
})
});
})
Logged
pams
Newbie
*
Posts: 4


View Profile Email
« Reply #2 on: September 22, 2019, 06:11:39 PM »

Thanks a lot Jarry.... it's work.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!