EasyUI Forum
May 17, 2024, 01:50:45 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: scrollview2 doesn't work if rownumbers is false  (Read 13246 times)
tomhj
Newbie
*
Posts: 40


View Profile
« on: October 15, 2013, 05:36:05 PM »

I'm trying to use the new scrollview2 to have virtual scrolling along with row detail drill-down.  The "Virtual Scroll View(Detail Rows)" is very close.  But what I found is the row expander icons/links do not show up unless you have rownumbers set to true.  The exact same code with rownumbers:false and using "view: detailview" works (but without the virtual scrolling).

scrollview2 works as long as rownumbers:true is set.

To prove this, I recreated the source from the "Virtual Scroll View (Detail Rows)" example:
Code:
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="http://www.jeasyui.com/easyui/datagrid-scrollview2.js"></script>

</head>
<body>
<div style="margin-bottom:10px">
    <select onchange="load(this.value)">
        <option value="remote">Load Remote Data</option>
        <option value="local">Load Local Data</option>
    </select>
    <table id="tt" title="DataGrid - VirtualScrollView with Detail Rows" style="width:700px;height:300px" data-options="
                view:scrollview2,rownumbers:true,singleSelect:true,
                url:'datagrid27_getdata.php',
                autoRowHeight:false,pageSize:50">
        <thead>
        <tr>
            <th field="inv" width="80">Inv No</th>
            <th field="date" width="90">Date</th>
            <th field="name" width="80">Name</th>
            <th field="amount" width="80" align="right">Amount</th>
            <th field="price" width="80" align="right">Price</th>
            <th field="cost" width="90" align="right">Cost</th>
            <th field="note" width="100">Note</th>
        </tr>
        </thead>
    </table>
    <script type="text/javascript">
        $(function(){
            $('#tt').datagrid({
                detailFormatter: function(rowIndex, rowData){
                    return '<table><tr>' +
                            '<td style="border:0;padding-right:10px">' +
                            '<p>Name: ' + rowData.name + '</p>' +
                            '<p>Amount: ' + rowData.amount + '</p>' +
                            '</td>' +
                            '<td style="border:0">' +
                            '<p>Price: ' + rowData.price + '</p>' +
                            '<p>Cost: ' + rowData.cost + '</p>' +
                            '</td>' +
                            '</tr></table>';
                }
            });
        });
        function loadLocal(){
            var rows = [];
            for(var i=1; i<=8000; i++){
                var amount = Math.floor(Math.random()*1000);
                var price = Math.floor(Math.random()*1000);
                rows.push({
                    inv: 'Inv No '+i,
                    date: $.fn.datebox.defaults.formatter(new Date()),
                    name: 'Name '+i,
                    amount: amount,
                    price: price,
                    cost: amount*price,
                    note: 'Note '+i
                });
            }
            $('#tt').datagrid('loadData', rows);
        }
        function load(mode){
            if (mode == 'local'){
                loadLocal();
            } else {
                $('#tt').datagrid({
                    url:'datagrid27_getdata.php'
                });
            }
        }
    </script>
    <style type="text/css">
        .datagrid-header-rownumber,.datagrid-cell-rownumber{
            width:40px;
        }
    </style>
</div>
</body>
</html>

Note:  The 'Load Remote Data' doesn't work in my example because of the browser blocking the AJAX request to fetch data due to same-origin.  But it works for the 'Load Local Data'.

All I need to is change "rownumbers:true" to "rownumbers:false" and the row expander icon is not displayed and doesn't work any more.

Any suggestions?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 16, 2013, 08:43:46 PM »

Please download the newest view files from http://www.jeasyui.com/extension/datagridview.php. The 'scrollview' supports detail view and the old 'scrollview2' has been discarded.
Logged
tomhj
Newbie
*
Posts: 40


View Profile
« Reply #2 on: October 16, 2013, 09:09:24 PM »

Works like a charm - thanks!
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!