Home > Backend Development > PHP Tutorial > javascript - The pagination display in easyui1.5 datagrid is not normal. Please help me.

javascript - The pagination display in easyui1.5 datagrid is not normal. Please help me.

WBOY
Release: 2016-10-11 14:23:13
Original
1180 people have browsed it

1. Problem description: When using easyui1.5, I found that if toolbar is used in datagrid, the paging control in datagrid will not display properly! Go down a few px, as shown in the picture: javascript - The pagination display in easyui1.5 datagrid is not normal. Please help me.

2. Findings after debugging (2 points):
1. There are 2 implementation methods for the datagrid toolbar. javascript - The pagination display in easyui1.5 datagrid is not normal. Please help me.
Not both implementations have the above problems. Only when using the

implementation will problems occur. When using js arrays, everything is displayed normally. 2. As long as you adjust the size of the browser window (shrink a little or enlarge a little), the paging display will be normal immediately. PS: I think the height is not calculated accurately during initialization~~

3. Question code:

<code> <script>
     $(function(){
        $('#category').datagrid({
            url: '{:U("Category/getList")}',
            border: false,
            toolbar: '#tbar',
            fit: true,

            columns:[[
                {field:'id',checkbox:true},
                {field:'sort',title:'排序',width:100},
                {field:'name',title:'栏目名称',width:100},
                {field:'create_time',title:'创建时间',width:100},
            ]],
            pagination: true,

            fitColumns: true,
            rownumbers: true,
            data: [
                {
                    "id": 1,
                    "sort": 1,
                    "name": "助力海东",
                    "create_time": "2016-08-15 15:13:87"
                },
                {
                    "id": 2,
                    "sort": 2,
                    "name": "助力海东",
                    "create_time": "2016-08-15 15:13:87"
                }
            ]
        });
    });
</script>

<table id="category"></table>
<div id="tbar" style="padding: 5px;">
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">新增</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">修改</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">删除</a>
</div>
</code>
Copy after login
Copy after login
Please help me if you have the same problem, thank you

Reply content:

1. Problem description: When using easyui1.5, I found that if toolbar is used in datagrid, the paging control in datagrid will not display properly! Go down a few px, as shown in the picture:

javascript - The pagination display in easyui1.5 datagrid is not normal. Please help me.

2. Findings after debugging (2 points):

1. There are 2 implementation methods for the datagrid toolbar.
javascript - The pagination display in easyui1.5 datagrid is not normal. Please help me.Not both implementations have the above problems. Only when using the

implementation will problems occur. When using js arrays, everything is displayed normally. 2. As long as you adjust the size of the browser window (shrink a little or enlarge a little), the paging display will be normal immediately. PS: I think the height is not calculated accurately during initialization~~

3. Question code:

<code> <script>
     $(function(){
        $('#category').datagrid({
            url: '{:U("Category/getList")}',
            border: false,
            toolbar: '#tbar',
            fit: true,

            columns:[[
                {field:'id',checkbox:true},
                {field:'sort',title:'排序',width:100},
                {field:'name',title:'栏目名称',width:100},
                {field:'create_time',title:'创建时间',width:100},
            ]],
            pagination: true,

            fitColumns: true,
            rownumbers: true,
            data: [
                {
                    "id": 1,
                    "sort": 1,
                    "name": "助力海东",
                    "create_time": "2016-08-15 15:13:87"
                },
                {
                    "id": 2,
                    "sort": 2,
                    "name": "助力海东",
                    "create_time": "2016-08-15 15:13:87"
                }
            ]
        });
    });
</script>

<table id="category"></table>
<div id="tbar" style="padding: 5px;">
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">新增</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true">修改</a>
    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">删除</a>
</div>
</code>
Copy after login
Copy after login

Please help me if you have the same problem, thank you

1. Just use js array to write it, and there will be no problem.

2. I have encountered many situations where the first time it was abnormal and the window would display normally just by changing the window, I guess the reason is this: easyui will get the height of the form for the first time, and then render the page, but you write the toolbar below Later, he thought that without that height, the paging would naturally go down a part when the toolbar is displayed. You can try adding the height attribute

<code>            height : $('#**').height()-**,
            pagination : true,
</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template