jQuery EasyUI – Bug Fix on Window and Dialog Position widget.

I’ve found a bug in “window” element or “dialog” element.
When you instantiate this widget, it go out of the main window browser, in particular in top and left position (when you drag o resize it).
To resolve this problem i’ve implemented this solution.

You can read the source code below:

$(dialog).window({
onMove: function(left, top) {
if (left < 0 || top < 0) {
left = (left < 0) ? 0 : left;
top = (top < 0) ? 0 : top;
$(this).window('move', {left: left, top: top});
}
},
onResize: function(width, height) {
var opt = $(this).window("options");
var top = opt.top;
var left = opt.left;
if (top < 0) {
top = (top < 0) ? 0 : top;
$(this).window('move', {left: left, top: top});
}
}
}).window("open");

The same code is for dialog:

$(dialog).dialog({
onMove: function(left, top) {
if (left < 0 || top < 0) {
left = (left < 0) ? 0 : left;
top = (top < 0) ? 0 : top;
$(this).dialog('move', {left: left, top: top});
}
},
onResize: function(width, height) {
var opt = $(this).window("options");
var top = opt.top;
var left = opt.left;
if (top < 0) {
top = (top < 0) ? 0 : top;
$(this).dialog('move', {left: left, top: top});
}
}
}).dialog("open");

Futhermore, when you call “$(this).window(“options”);” inside “onResize” method, and start your App,
you don’t see the window; so i must insert the “.window(“open”);” at the and of declaration of dialog.

I hope to help you.

Best Regards,
Enrico

2 Risposte a “jQuery EasyUI – Bug Fix on Window and Dialog Position widget.”

  1. I’ll right away seize your rss as I can’t find your email subscription hyperlink or e-newsletter
    service. Do you have any? Kindly let me recognise in order that I may just subscribe.
    Thanks.

  2. It’s really a cool and helpful piece of information. I am satisfied that you just shared this helpful info with us.
    Please keep us informed like this. Thanks for sharing.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *