EasyUI Forum
May 21, 2024, 06:41:10 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: Datagrid scrolls up when I'm editing it  (Read 2753 times)
NortT
Newbie
*
Posts: 18


View Profile Email
« on: October 31, 2017, 09:37:25 PM »

Hello, I have a problem with datagrid. When I'm trying to edit a row in a datagrid table the entire page scrolls up so I can't see the raw I want to edit and I need to scroll the page down. I use formatter with the following code:
Code:
	function formatAction(value,row,index){
if (row.editing){
var s = '<a href="#" onclick="saverow(this)">Save</a> ';
var c = '<a href="#" onclick="cancelrow(this)">Cancel</a>';
return s+c;
} else {
var e = '<a href="#" onclick="editrow(this)">Edit</a> ';
return e;
}
}
and an edit function:
Code:
	function editrow(target){
var rows = $('#productTable').datagrid('getRows');
var row = rows[getRowIndex(target)];
$.ajax({
url: 'getVolume.php?product=' + row.name,
success: function(data) {
var col = $('#productTable').datagrid('getColumnOption', 'volume');
col.editor.options.data = eval(data);
if (row.isProduct == 'true')
$('#productTable').datagrid('beginEdit', getRowIndex(target));
}
});
}

So how can I set the focus on the row I'm editing? I've read this topic (https://www.jeasyui.com/forum/index.php?action=printpage;topic=3138.0) and I can set a focus on the selected row, but I still cant see this row and I need to sroll down the page.
« Last Edit: November 01, 2017, 02:23:53 AM by NortT » Logged
NortT
Newbie
*
Posts: 18


View Profile Email
« Reply #1 on: November 01, 2017, 01:39:56 AM »

I solved the problem. I rewrite my code using onDblClick, so I enter in the edit mode without formatter. In this case the table doesn't scroll up.
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!