EasyUI Forum
May 13, 2024, 10:16:02 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: Adding handler in Easyui Desktop  (Read 7374 times)
Alfred
Full Member
***
Posts: 134


-Licensed User-


View Profile
« on: July 18, 2018, 08:56:06 PM »

I am trying to add a handler in the desktop app. But this is not working. Since desktop extension is on top of easyui window, it is not possible to make it work like a dialog as well. For example I tried to add buttons option it is not working.

Code:
$('body').desktop({
apps: [{
name: 'All Projects',
icon: 'images/alldoc.png',
width: 800,
height: 400,
left: 200,
top: 50,
                handler:function(){
                  alert('handler');
               }
}]
});

Please help.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 19, 2018, 01:31:09 AM »

You can define the 'content' property, let it display buttons on the bottom.
Code:
<style type="text/css">
.f-column{
display: flex;
flex-direction: column;
position: relative;
}
.f-full{
flex: 1 1 auto;
}
</style>

$('body').desktop({
apps: [{
name: 'Computer',
icon: 'images/computer.png',
width: 800,
height: 400,
left: 200,
top: 50,
bodyCls: 'panel-noscroll',
content: '<div class="f-column cc" style="height:100%"><div class="f-full"></div><div class="dialog-button"><a href="javascript:;" class="easyui-linkbutton">Button</a></div></div>'
...
});
$.parser.parse('.cc')
Logged
Alfred
Full Member
***
Posts: 134


-Licensed User-


View Profile
« Reply #2 on: July 19, 2018, 01:41:45 AM »

Thanks for quick reply.
Will it be possible to have handler? Please can you give an example. The above example does not work for me.

Thanks again
« Last Edit: July 19, 2018, 01:52:41 AM by Alfred » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: July 19, 2018, 02:03:10 AM »

Please look at this example http://code.reloado.com/udonex3/edit#preview
Logged
Alfred
Full Member
***
Posts: 134


-Licensed User-


View Profile
« Reply #4 on: July 19, 2018, 03:02:08 AM »

The problem is that it does not work well with
Code:
href:
. As I cannot make the code to close the window, so it would be better to have a handler.
Code:
$(this).window('close');
will not work.
If you can give one, I would highly appreciate.
« Last Edit: July 19, 2018, 08:13:13 AM by Alfred » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #5 on: July 19, 2018, 05:51:00 PM »

The toolbar and buttons are added into the desktop window. Please download the newest desktop extension from https://www.jeasyui.com/extension/desktop.php

The example is available from http://code.reloado.com/udonex3/2/edit#html
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!