{"id":592,"date":"2023-02-25T13:55:38","date_gmt":"2023-02-25T06:55:38","guid":{"rendered":"https:\/\/ddes.onde.go.th\/?page_id=592"},"modified":"2023-02-25T14:36:09","modified_gmt":"2023-02-25T07:36:09","slug":"onde-dashboard2","status":"publish","type":"page","link":"https:\/\/ddes.onde.go.th\/index.php\/onde-dashboard2\/","title":{"rendered":"onde-dashboard2"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>let loadedResolve, reportLoaded = new Promise((res, rej) => { loadedResolve = res; });\r\nlet renderedResolve, reportRendered = new Promise((res, rej) => { renderedResolve = res; });\r\n\r\n\/\/ Get models. models contains enums that can be used.\r\nmodels = window&#91;'powerbi-client'].models;\r\n\r\n\/\/ Embed a Power BI report in the given HTML element with the given configurations\r\n\/\/ Read more about how to embed a Power BI report in your application here: https:\/\/go.microsoft.com\/fwlink\/?linkid=2153590\r\nfunction embedPowerBIReport() {\r\n    \/*-----------------------------------------------------------------------------------+\r\n    |    Don't change these values here: access token, embed URL and report ID.          | \r\n    |    To make changes to these values:                                                | \r\n    |    1. Save any other code changes to a text editor, as these will be lost.         |\r\n    |    2. Select 'Start over' from the ribbon.                                         |\r\n    |    3. Select a report or use an embed token.                                       |\r\n    +-----------------------------------------------------------------------------------*\/\r\n    \/\/ Read embed application token\r\n    let accessToken = EMBED_ACCESS_TOKEN;\r\n\r\n    \/\/ Read embed URL\r\n    let embedUrl = EMBED_URL;\r\n\r\n    \/\/ Read report Id\r\n    let embedReportId = REPORT_ID;\r\n\r\n    \/\/ Read embed type from radio\r\n    let tokenType = TOKEN_TYPE;\r\n\r\n    \/\/ We give All permissions to demonstrate switching between View and Edit mode and saving report.\r\n    let permissions = models.Permissions.All;\r\n\r\n    \/\/ Create the embed configuration object for the report\r\n    \/\/ For more information see https:\/\/go.microsoft.com\/fwlink\/?linkid=2153590\r\n    let config = {\r\n        type: 'report',\r\n        tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,\r\n        accessToken: accessToken,\r\n        embedUrl: embedUrl,\r\n        id: embedReportId,\r\n        permissions: permissions,\r\n        settings: {\r\n            panes: {\r\n                filters: {\r\n                    visible: true\r\n                },\r\n                pageNavigation: {\r\n                    visible: true\r\n                }\r\n            }\r\n        }\r\n    };\r\n\r\n    \/\/ Get a reference to the embedded report HTML element\r\n    let embedContainer = $('#embedContainer')&#91;0];\r\n\r\n    \/\/ Embed the report and display it within the div container.\r\n    report = powerbi.embed(embedContainer, config);\r\n\r\n    \/\/ report.off removes all event handlers for a specific event\r\n    report.off(\"loaded\");\r\n\r\n    \/\/ report.on will add an event handler\r\n    report.on(\"loaded\", function () {\r\n        loadedResolve();\r\n        report.off(\"loaded\");\r\n    });\r\n\r\n    \/\/ report.off removes all event handlers for a specific event\r\n    report.off(\"error\");\r\n\r\n    report.on(\"error\", function (event) {\r\n        console.log(event.detail);\r\n    });\r\n\r\n    \/\/ report.off removes all event handlers for a specific event\r\n    report.off(\"rendered\");\r\n\r\n    \/\/ report.on will add an event handler\r\n    report.on(\"rendered\", function () {\r\n        renderedResolve();\r\n        report.off(\"rendered\");\r\n    });\r\n}\r\n\r\nembedPowerBIReport();\r\nawait reportLoaded;\r\n\r\n\/\/ Insert here the code you want to run after the report is loaded\r\n\r\nawait reportRendered;\r\n\r\n\/\/ Insert here the code you want to run after the report is rendered\r\n\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-592","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ddes.onde.go.th\/index.php\/wp-json\/wp\/v2\/pages\/592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ddes.onde.go.th\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ddes.onde.go.th\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ddes.onde.go.th\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ddes.onde.go.th\/index.php\/wp-json\/wp\/v2\/comments?post=592"}],"version-history":[{"count":4,"href":"https:\/\/ddes.onde.go.th\/index.php\/wp-json\/wp\/v2\/pages\/592\/revisions"}],"predecessor-version":[{"id":598,"href":"https:\/\/ddes.onde.go.th\/index.php\/wp-json\/wp\/v2\/pages\/592\/revisions\/598"}],"wp:attachment":[{"href":"https:\/\/ddes.onde.go.th\/index.php\/wp-json\/wp\/v2\/media?parent=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}