Oracle APEX Faceted Search doesn't display BPMN diagram well on change

274 views Asked by At

I am using cards to display diagrams. When page is load or reload diagram is displayed well, but when I use Faceted Search cards region is refreshed(without reload) and diagram doesn't fit in card.

Screenshots:

https://i.stack.imgur.com/1hO5A.png

enter image description here

Cards region query

select 
    ID,
    TITLE as CARD_TITLE,
    DIAGRAM,
    apex_page.get_url (
        p_page => 21,
        p_items => 'P21_ID', 
        p_values => "ID") as CARD_LINK,
    null as CARD_INITIALS,
    null as CARD_SUBTITLE,
    null as CARD_SUBTEXT,
    '<!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8" />
            <!-- viewer -->
            <script src="https://unpkg.com/[email protected]/dist/bpmn-viewer.development.js"></script>
            <script src="https://unpkg.com/[email protected]/dist/jquery.js"></script>
            <style>
                html, body{
                height: auto;
                padding: 0;
                margin: 0;
                }

                #canvas'|| id ||' {
                    height: auto;
                    padding: 0;
                    margin: 0;
                }
            </style>
        </head>
        <body>
            <div id="canvas'|| id ||'"></div>
            <script>
                var bpmnViewer = new BpmnJS({
                    container: "#canvas'|| id ||'"
                });
                async function openDiagram() {
                    try {
                        await bpmnViewer.importXML(`' || diagram || '`);
                        var canvas = bpmnViewer.get("canvas");
                        canvas.zoom("fit-viewport");
                    } catch (err) {
                        console.error("could not import BPMN 2.0 diagram", err);
                    }
                }
                openDiagram();
            </script>
        </body>
    </html>' as CARD_TEXT
  from DIAGRAM_TABLE

How can I display diagrams correctly in cards after region refresh?

Thanks in advance!

0

There are 0 answers