EasyUI Forum
May 04, 2024, 01:22:59 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: Dialog with layouts not resizing  (Read 4944 times)
WizPS
Jr. Member
**
Posts: 67


View Profile
« on: August 29, 2019, 06:41:17 PM »

I have the following code for creating a re-sizable dialog box in js. However resize makes the layout panels not following the dialogue box. I tried to add fit:true but it does not help.
Please advice.
Code:
function my_dialog() {
using(['dialog'], function () {
var $myDialog = $("<div/>", { id: 'dlg' });
$myDialog.dialog({ width: 400, height: 200, resizable: true });
$myDialog.layout();
$myDialog.layout('add', { region: 'center', content: 'center'});
$myDialog.layout('add', { region: 'west', content: 'west', width: 200, split: true });
});
}
Logged
jahangir
Jr. Member
**
Posts: 51



View Profile Email
« Reply #1 on: August 29, 2019, 11:18:50 PM »

Add following code at the end of your function "my_dialog()"

Code:

$myDialog.dialog({
onResize:function(w, h){
$myDialog.layout('panel', 'center').panel('resize',{height:h, width: w - 200});
$myDialog.layout('panel', 'west').panel('resize',{height:h});
}
});



Please check this example.

http://code.reloado.com/jbhatti/17/edit#html,live
Logged
WizPS
Jr. Member
**
Posts: 67


View Profile
« Reply #2 on: August 30, 2019, 03:08:59 AM »

Thank you jahangir. In the following example there is no extra code for resizing and still it works:
https://www.jeasyui.com/demo/main/index.php?plugin=Window&theme=material-teal&dir=ltr&pitem=&sort=asc
(clicking 'Window Layout' example)

Do you believe is it possible get the same behavior using js, so I don't need the extra function for resizing?
« Last Edit: August 30, 2019, 03:12:14 AM by WizPS » Logged
jahangir
Jr. Member
**
Posts: 51



View Profile Email
« Reply #3 on: August 30, 2019, 04:54:08 AM »

Please check this.

http://code.reloado.com/jbhatti/20/edit#html,live
« Last Edit: August 30, 2019, 04:59:52 AM by jahangir » Logged
WizPS
Jr. Member
**
Posts: 67


View Profile
« Reply #4 on: August 30, 2019, 07:28:34 AM »

Wonderful jahangir, this really is a nice solution and it helps a lot. Thank you very much!
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!