EasyUI Forum
April 28, 2024, 10:13:15 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: Messager position  (Read 4913 times)
chrwei
Full Member
***
Posts: 219


View Profile Email
« on: June 03, 2020, 01:07:54 PM »

When using Messager.alert, and probably the other methods too, the position is set the first time it is displayed.  Scroll the page and display it again and it may be out of view
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: June 04, 2020, 06:53:45 PM »

You can set the 'position' style with 'fixed' when open the alert dialog.
Code:
this.messager.alert({
  title: "Alert",
  msg: "Here is a message!",
  style: {
    position: 'fixed'
  }
});
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #2 on: June 09, 2020, 10:58:39 AM »

that had no effect, at best this would let me specify where it should be placed, right?

it does already calculate placing the dialog in the center of view, even when scrolled down, just that it only does this calculation the first time it's displayed, instead of every time
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #3 on: July 07, 2020, 12:09:29 PM »

workaround with this, but it does some odd scrolling things if the parent panel's length changes between dialogs.  at least the dialog is always visible.

Code:
export class MyMessager extends Messager {
    onOpen() {
        let iv = setInterval(() => {
            if(this.dialog) {
                clearInterval(iv);
                this.dialog.vcenter();
            }
        }, 50);
    }

    render() {
        return (
            <MessagerDialog
                ref={ref => this.dialog = ref}
                onOpen={this.onOpen.bind(this)}
                {...this.props}
                {...this.state}
            />
        )
    }
}
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!