EasyUI Forum
April 29, 2024, 02:12:27 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: datagrid virtual scroll view get row  (Read 12390 times)
varonica
Full Member
***
Posts: 106


View Profile
« on: October 27, 2013, 07:11:50 PM »

I'm using edit function to get row from datagrid virtual scroll view. And edit function looks like this:
Code:
function editUser(){  
var row = $('#tt').datagrid('getSelected'); 
if (row){ 
alert(row.inv);
}
}

It only works for the first 50 rows.
Here is my full code:
Code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="jquery,ui,easy,easyui,web">
<meta name="description" content="easyui help you build your web page easily!">
<title>DataGrid Virtual Scrolling - jQuery EasyUI Demo</title>
<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-scrollview.js"></script>
</head>
<body>
<h2>DataGrid Virtual Scroll View Demo</h2>
<div class="demo-info" style="margin-bottom:10px">
<div class="demo-tip icon-tip">&nbsp;</div>
<div>Drag the vertical scroll and release it to navigate to the desired page.</div>
</div>
<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>
</div>
<table id="tt" title="DataGrid - VirtualScrollView" style="width:700px;height:300px" data-options="
view:scrollview,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="100">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="100" align="right">Cost</th>
<th field="note" width="110">Note</th>
</tr>
</thead>
</table>
<a class="easyui-linkbutton" onClick="editUser()" >Edit</a>
<script type="text/javascript">
$(function(){
$('#tt').datagrid();
});
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 {
                        // http://www.jeasyui.com/demo/main/datagrid27_getdata.php <- data
$('#tt').datagrid({
url:'datagrid27_getdata.php'
});
}
}
function editUser(){ 
var row = $('#tt').datagrid('getSelected'); 
if (row){ 
alert(row.inv);
}
}
</script>
<style type="text/css">
.datagrid-header-rownumber,.datagrid-cell-rownumber{
width:40px;
}
</style>
</body>
</html>

Please help!!!   Sad Sad Sad Huh Huh Cry Cry Cry Cry Cry
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 28, 2013, 12:22:31 AM »

To solve this issue, please download the newest scroll view from http://www.jeasyui.com/extension/datagridview.php.
Logged
varonica
Full Member
***
Posts: 106


View Profile
« Reply #2 on: October 28, 2013, 02:33:19 AM »

Thanks!! YOU SAVE ME AGAIN...  Smiley Smiley Smiley Wink Wink Wink Cheesy Cheesy Cheesy Grin Grin Grin Grin Cool Cool Cool Cool Kiss Kiss Kiss Kiss Kiss Kiss
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!