EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: NortT on October 31, 2017, 09:37:25 PM



Title: Datagrid scrolls up when I'm editing it
Post by: NortT 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.


Title: Re: Datagrid scrolls up when I edit it
Post by: NortT 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.