EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: elcidofauy on October 04, 2014, 11:56:04 PM



Title: Confirmation Message Box Position
Post by: elcidofauy on October 04, 2014, 11:56:04 PM
Dear All,

This one is driving me a little insane as positioning items is simple in most cases...

My problem relates to the confirmation message box which is always centered relative to the height of the page i.e. content length and not to the actual screen size (actual height of the screen). Therefore if the page is really long the message box is always shown at the bottom of the screen ...

In simple terms why is it not possible to simply apply position attributes to the confirmation (and prompt) messager boxes as with the other message box type... I note that this property does not exist for this type as per documentation... I've also tried to fix this using stylesheet attributes but to no avail...

Here is a partial code example:


$.messager.confirm('Confirm','Are you sure you want to remove this xxxx?',function(r){
      if (r){
             //Do something 
      }
});

I'm basically trying to add the below (a rough example whilst looking online):

function popupwindow(url, title, w, h) {
  var left = (screen.width/2)-(w/2);
  var top = (screen.height/2)-(h/2);
  return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}


What can I add to this to position the confirmation box relative to the screen? Can it be done using stylesheets? Appreciate any help/guidance on how to solve this!!!  ??? ??? ???

Many Thanks in Advance...





Title: Re: Confirmation Message Box Position
Post by: stworthy on October 05, 2014, 04:50:26 AM
Calling the $.messager.confirm function can return the confirm message window object. You can call 'move' method to move this window to the new position you want.
Code:
var win = $.messager.confirm('My Title', 'Are you confirm this?', function(r){
if (r){
alert('confirmed: '+r);
}
});
win.window('move',{
left:100,
top:100
})


Title: Re: Confirmation Message Box Position
Post by: elcidofauy on October 05, 2014, 05:41:12 AM
Dear Stworthy, Yes indeed that worked like a charm!!! Thank you so much for getting back on this so quickly... Awesome....  :)  ;D