EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Stefan B. on January 16, 2014, 06:49:30 AM



Title: How can I add default user buttons to the pagination
Post by: Stefan B. on January 16, 2014, 06:49:30 AM
How can I add default user buttons to the pagination like this:

Code:
$.fn.pagination.defaults = $.extend({}, $.fn.pagination.defaults, {
loading: true,
beforePageText: paginationPageLabel,
afterPageText: paginationPageOfLabel +" {pages}",
displayMsg: paginationFooterMsg,

buttons:[{
          iconCls:'icon-add',
          text: 'add',
          handler:function(){
        //code by Option?
  }
        },{
          iconCls:'icon-save',
          text: 'save',
          handler:function(){
        //code by Option?
  }
        },{
          iconCls:'icon-remove',
          text: 'remove,
          handler:function(){
        //code by Option?
  }
        },{
           iconCls:'icon-cancel',
           text: 'cancel',
          handler:function(){
        //code by Option?
  }
        }]

});

and can I disable buttons with user options set on special pages like this:

Code:
	$('#edServerServerRel').datagrid('getPager').pagination({ // get the pager of datagrid
            disableAddButton: true,
            cancelHandlerCode: 'jsMethodeXyz'
});


Title: Re: How can I add default user buttons to the pagination
Post by: stworthy on January 16, 2014, 07:09:54 PM
Extending $.fn.pagination.defaults will apply to all the pagination components. If you wish to add some buttons to a datagrid pager bar, attaching from some existing elements may be more flexible.
Code:
<div id="tt">
<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true"></a>
<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true"></a>
<a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true"></a>
<a href="#" class="easyui-linkbutton" iconCls="icon-cut" plain="true"></a>
<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true"></a>
</div>

$(function(){
$('#dg').datagrid('getPager').pagination({
buttons:$('#tt')
});
});