EasyUI Forum
June 26, 2024, 07:30:12 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: Programatically resize a panel in layout [solved]  (Read 5605 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« on: November 20, 2016, 02:11:10 AM »

I need to save the resized height of a panel to local storage / cooke and then when the user opens the page again set the panel to the previous height.

I do not need help saving and getting cookies, but how can I capture the user resizing a panel which is inside a layout ??

Code:
<layout id="sqlpan">
  <region=north>
  <region=center>

$(document).ready(function() {

  setTimeout(function(){
    $('#sqlpan').layout('panel', 'north').panel({
      onResize: function(h,w) {
        [save h to cookie]
      }
    }).resize({height:[get h from cookie]})
  })

})

Update - it appears that you have to wrap it in a timeout to push to the bottom of the stack as the layout is not ready when the document ready() fires.

But how can I programatically resize the HEIGHT of the north panel ??



« Last Edit: November 21, 2016, 06:49:31 AM by devnull » Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2267


View Profile Email
« Reply #1 on: November 20, 2016, 07:06:57 AM »

Please refer to the code below:
Code:
$(function(){
var height = ...; // get height from cookie
var p = $('#layout').layout('panel','north');
if (height){
p.panel('resize', {height:height});
$('#layout').layout('resize');
}
p.panel('options').onResize = function(width,height){
// save the height to cookie
}
})
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 on: November 21, 2016, 06:49:15 AM »

Thanks so much
Logged

-- Licensed User --
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!