EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: BinaryCode on July 01, 2015, 03:55:52 PM



Title: Custom Pagination for Datagrid
Post by: BinaryCode on July 01, 2015, 03:55:52 PM
Hi,

I have problem custom pagination to custom layout button and add searchbox for datagrid:

First time OK,

Code:
var pager = listVehicle.datagrid('getPager');
        pager.pagination({
            pageSize: 50,
            pageList: [50, 100, 200],
            layout: ['list', 'prev', 'next'],
            buttons: '#buttons',
            displayMsg: '' //{from} to {to} of {total} Data
        });

<div id="buttons">
    <table style="border-spacing:0">
        <tr>
            <td>
                <input class="easyui-searchbox" style="width:150px">
            </td>
            <td>
                <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true"></a>
            </td>
        </tr>
    </table>
</div>


But..., after call:

Code:
listVehicle.datagrid('loadData', {"total": 0, "rows": []});
    listVehicle.datagrid({
        queryParams: {
            user_id: id
        }
    });

Pagination back to default,

Help me please,

TIA,


Title: Re: Custom Pagination for Datagrid
Post by: jarry on July 01, 2015, 05:03:03 PM
Please notice that calling .datagrid({...}) with a configuration object as the parameter will re-create the datagrid again. You should prevent from doing that. If you just want to set the 'queryParams' property, please try this:
Code:
var opts = listVehicle.datagrid('options');
opts.queryParams = {
  user_id: ...
};


Title: Re: Custom Pagination for Datagrid
Post by: BinaryCode on July 01, 2015, 06:17:50 PM
Hi Jerry,

Great very help me,

TIA