Page 1 of 1

Popup windows won't reposition with php backend

Posted: Tue Aug 16, 2022 11:55 am
by CAPL_INFO
Hey
I've been using Rich displays with RPG backend with no issues, and when I use a pop-up style record format (Overlay=true, show as window=true) with an RPG backend, I can then move the popup around the screen to see what's behind it.
However, I'm now writing a new program with a php backend and the popup behavior doesn't work for some reason.
Here's a minimal reproductible example:

Screen:

Code: Select all

{
  "text": "",
  "formats": [
    {
      "screen": {
        "record format name": "REPRO01A"
      },
      "items": [
        {
          "id": "Label1",
          "field type": "output field",
          "css class": "label",
          "value": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum",
          "left": "15px",
          "top": "250px",
          "width": "150px"
        }
      ]
    },
    {
      "screen": {
        "record format name": "REPRO01B",
        "overlay": "true",
        "show as window": "true",
        "center window": "true"
      },
      "items": [
        {
          "id": "Panel1",
          "field type": "css panel",
          "value": "Panel Title",
          "left": "255px",
          "top": "120px",
          "width": "200px",
          "height": "300px",
          "z index": "8",
          "header theme": "A - Black",
          "body theme": "C - Gray"
        }
      ]
    }
  ],
  "keywords": []
}
Backend:

Code: Select all

<?php 


header("Content-Type: application/json");


$data = array();
$view = '/profoundui/userdata/dspf/repro01/REPRO01.json';
$screens = array('REPRO01A', 'REPRO01B');

$output = array('view' => $view, 'screens' => $screens, 'data' => $data);
echo json_encode($output);

?>
Wonder if this is a bug or if I'm doing something wrong

Re: Popup windows won't reposition with php backend

Posted: Tue Aug 23, 2022 3:30 am
by CAPL_INFO
For anyone interested, I found a workaround to solve my problem.
I incorporated my panel into a simple container layout, and then passed the container's ID to standard javascript drag-to-reposition code: https://www.w3schools.com/howto/howto_js_draggable.asp

Code: Select all

pui.onload = function(config) {
	console.log("Screen:" + config["name"]);
    if (config["name"] == 'STA058A2') {
        handleG1Scroll();
        initM();
    }
    if (config["name"] == 'STA058A3') {
    	dragElement(document.getElementById("Layout2"));
    }
    
}