EasyUI Forum
September 15, 2025, 03:58:32 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] the rownumbers display bug in datagrid  (Read 10241 times)
LoreYun
Newbie
*
Posts: 4


View Profile
« on: May 09, 2016, 10:43:05 PM »

I have only one tabs in a static HTML, and two panels in the tabs. Each panel has a datagrid which show the rownumbers.
If I init the "onSelect" event for two datagrids, then one rownumber is normal who is default selected panel in tabs, but the other datagrid is abnormal.

I tried "resize" datagrid when select panel, but doesn't work.
If I comment the init of "onSelect" event, it will be ok.
test code:
Code:
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script type='text/javascript' src='../components/easyui_1.4/easyui-include.js'></script>
</head>
<body>
<div class="easyui-tabs" id="tab" style="width:810px;height: 500px" data-options="selected:1">
    <div id="tab1" title="tab1" style="padding:10px">
        <table id="list_tab1" class="easyui-datagrid" style="width:358px;height: 434px"
               data-options="rownumbers:true">
            <thead>
            <tr>
                <th data-options="field:'info',width:85,align:'left',resizable:false">
                    info
                </th>
                <th data-options="field:'content',width:130,align:'left',resizable:false">
                    content
                </th>
                <th data-options="field:'retrievePerson',width:85,align:'left',resizable:false">
                    retrievePerson
                </th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>1<br>2<br>3<br>4</td>
                <td>content 1234567890, 1234567890,, 12345678910,, ,</td>
                <td>123123,......<br><a>See All</a></td>
            </tr>
            <tr>
                <td>1<br>2<br>3<br>4</td>
                <td>content 1234567890, 1234567890,, 12345678910,, ,</td>
                <td>123123,......<br><a>See All</a></td>
            </tr>
            </tbody>
        </table>
    </div>
    <div id="tab2" title="tab2" style="padding:10px">
        <table id="list_tab2" class="easyui-datagrid" style="width:358px;height: 434px"
               data-options="rownumbers:true">
            <thead>
            <tr>
                <th data-options="field:'info',width:85,align:'left',resizable:false">
                    info
                </th>
                <th data-options="field:'content',width:130,align:'left',resizable:false">
                    content
                </th>
                <th data-options="field:'retrievePerson',width:85,align:'left',resizable:false">
                    retrievePerson
                </th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>1<br>2<br>3<br>4</td>
                <td>content 1234567890, 1234567890,, 12345678910,, ,</td>
                <td>223311,......<br><a>See All</a></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>

</body>

<script type='text/javascript'>
    $(function () {
        $('#list_tab1').datagrid({
            onSelect: function (index, data) {
            }
        });
        $('#list_tab2').datagrid({
            onSelect: function (index, data) {
            }
        });
//        $('#tab').tabs({
//            onSelect: function (title, index) {
//                if (index === 0) {
//                    $('#list_tab1').datagrid('resize');
//                    console.log("list_tab1");
//                } else if (index === 1) {
//                    $('#list_tab2').datagrid('resize');
//                    console.log("list_tab2");
//                }
//            }});
    });
</script>
</html>
« Last Edit: May 10, 2016, 12:28:19 AM by LoreYun » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 09, 2016, 11:42:32 PM »

You create the 'tabs' and 'datagrid' components more than once. If you are using the javascript code to create the components, please remove the 'easyui-tabs' and 'easyui-datagrid' class from the elements. You also can call 'fixRowHeight' method to reset the row height of the datagrid.
Logged
LoreYun
Newbie
*
Posts: 4


View Profile
« Reply #2 on: May 10, 2016, 12:24:50 AM »

Hi stworthy,
Thank a lot!  Cheesy
 'fixRowHeight' is worked!

In fact, I use "data-options:url" to load data. Only static HTML has this problem.

fixed code:
Code:
$('#tab').tabs({
    onSelect: function (title, index) {
        if (index === 0) {
            $('#list_tab1').datagrid('fixRowHeight');
        } else if (index === 1) {
            $('#list_tab2').datagrid('fixRowHeight');
        }
    }});
Thanks again.
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!