EasyUI Forum
May 21, 2024, 03:08:01 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: Scroll record to top of view when expanding?  (Read 4297 times)
MB34
Newbie
*
Posts: 20


View Profile
« on: April 30, 2015, 10:05:20 AM »

I'm using the crud example. Is there a way to make the row scroll to the top of the view when expanding the row to edit it?

As shown in my other post, scrollTo() doesn't work for me at all, no matter where I put it.
Logged
MB34
Newbie
*
Posts: 20


View Profile
« Reply #1 on: April 30, 2015, 12:13:22 PM »

I used another jQuery plugin called jQuery-ScrollTo, http://balupton.github.io/jquery-scrollto/ to do this.

In case you are wondering how. I did this in the onLoad for the ddv.panel:

Code:
var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv');
ddv.panel({
    border:false,
    cache:true,
    href:'show_form.php?index='+index,
    onLoad:function(){
        $('#dg').datagrid('fixDetailRowHeight',index);
        $('#dg').datagrid('selectRow',index);
        $('#dg').datagrid('getRowDetail',index).find('form').form('load',row);
        ddv.ScrollTo({duration: 0,easing: 'linear',offsetTop: 26}); // This scrolls the current row to the top of the view.
    }
});

If someone has an answer on how to do this without the other plugin, let me know, otherwise, I'm marking this as solved.
« Last Edit: April 30, 2015, 12:15:21 PM by MB34 » 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!