0

Example of how to use the new Embed framework in Pyramid 2020.11 onwards

Below is a simple sample code example of how to use the new embed framework.

Update the username, password and contentID(to get the ID, right click on the item to embed >Metadata) to those relevant to your Pyramid setup. If using a filter then update with the filter hierarchy, level and filter item you want to filter by. If no filter is required then just comment it out as below
//var filters = Filter.create();

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Simple Embed Example</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
    <script src="https://MyPyramidSite.com/no-shell/pyramid-embed-js.min.js"></script>
    <meta charset="UTF-8">
</head>

<body>
    <h1>My Report</h1>
    <div id="myContainer" style="width:1000px;height:400px;"></div>

<script>
        function embedDemo() {
            var client = new PyramidEmbedClient('https://MyPyramidSite.com', 'username', 'password!');

var filters = Filter.create();
            filters.add("dates", "year", "2015");

client.embed(document.getElementById('myContainer'), {
                contentId: '7ce217a0-edb4-4c2a-a590-3199c3b5afbc',
                filters: filters,
            });
        }

$(document).ready(function(){
            embedDemo();
        });
    </script>
</body>
</html>

For futher reading please see our extensive help site embed section. For a general over view click here and for futher reading click here

Reply

null