Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery EasyUI DataGrid - Custom Pagination

jQuery EasyUI DataGrid - Custom Pagination

The datagrid has a built-in pagination feature with great capabilities, and customizing it is quite simple. In this tutorial, we will create a datagrid and add some custom buttons to the pagination toolbar.

Create the DataGrid



    

        

            

                

                

                

                

                

                

            

        

    
Item IDProduct IDList PriceUnit CostAttributeStauts

Remember to set the 'pagination' property to true so that the pagination toolbar is generated.

Customize the pagination toolbar



    var pager = $('#tt').datagrid('getPager');    // get the pager of datagrid

    pager.pagination({

        showPageList:false,

        buttons:[{

            iconCls:'icon-search',

            handler:function(){

                alert('search');

            }

        },{

            iconCls:'icon-add',

            handler:function(){

                alert('add');

            }

        },{

            iconCls:'icon-edit',

            handler:function(){

                alert('edit');

            }

        }],

        onBeforeRefresh:function(){

            alert('before refresh');

            return true;

        }

    });

As you can see, we first get the datagrid's pager object, then recreate the pagination. We hide the page list and add three new buttons.

Download the jQuery EasyUI example

jeasyui-datagrid-datagrid11.zip