Skip to content

Commit 0505558

Browse files
committed
1 parent 386e2b4 commit 0505558

File tree

4 files changed

+126
-1
lines changed

4 files changed

+126
-1
lines changed

demo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"fetch": "^1.0.0",
3636
"http-server": "^0.10.0",
3737
"jquery": "^3.1.0",
38-
"powerbi-client": "2.6.0",
38+
"powerbi-client": "2.6.1",
3939
"syntaxhighlighter": "4.0.1"
4040
},
4141
"devDependencies": {}

demo/v2-demo/scripts/codesamples.js

+109
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,115 @@ function _Report_ApplyCustomLayout() {
948948
});
949949
}
950950

951+
function _Report_HideAllVisualHeaders() {
952+
953+
// New settings to hide all the visual headers in the report
954+
const newSettings = {
955+
visualSettings: {
956+
visualHeaders: [
957+
{
958+
settings: {
959+
visible: false
960+
}
961+
// No selector - Hide visual header for all the visuals in the report
962+
}
963+
]
964+
}
965+
};
966+
967+
// Get a reference to the embedded report HTML element
968+
var embedContainer = $('#embedContainer')[0];
969+
970+
// Get a reference to the embedded report.
971+
report = powerbi.get(embedContainer);
972+
973+
// Update the settings by passing in the new settings you have configured.
974+
report.updateSettings(newSettings)
975+
.then(function () {
976+
Log.log("Visual header was successfully hidden for all the visuals in the report.");
977+
})
978+
.catch(function (error) {
979+
Log.log(errors);
980+
});
981+
982+
}
983+
984+
function _Report_ShowAllVisualHeaders() {
985+
// New settings to show all the visual headers in the report
986+
const newSettings = {
987+
visualSettings: {
988+
visualHeaders: [
989+
{
990+
settings: {
991+
visible: true
992+
}
993+
// No selector - Show visual header for all the visuals in the report
994+
}
995+
]
996+
}
997+
};
998+
999+
// Get a reference to the embedded report HTML element
1000+
var embedContainer = $('#embedContainer')[0];
1001+
1002+
// Get a reference to the embedded report.
1003+
report = powerbi.get(embedContainer);
1004+
1005+
// Update the settings by passing in the new settings you have configured.
1006+
report.updateSettings(newSettings)
1007+
.then(function () {
1008+
Log.log("Visual header was successfully shown for all the visuals in the report.");
1009+
})
1010+
.catch(function (error) {
1011+
Log.log(errors);
1012+
});
1013+
1014+
}
1015+
1016+
function _Report_HideSingleVisualHeader() {
1017+
1018+
// Define settings to hide the header of a single visual
1019+
var newSettings = {
1020+
visualSettings: {
1021+
visualHeaders: [
1022+
{
1023+
settings: {
1024+
visible: true
1025+
}
1026+
// No selector - Show visual header for all the visuals in the report
1027+
},
1028+
{
1029+
settings: {
1030+
visible: false
1031+
},
1032+
selector: {
1033+
$schema: "http://powerbi.com/product/schema#visualSelector",
1034+
visualName: "VisualContainer7"
1035+
// The visual name can be retrieved using getVisuals()
1036+
// Hide visual header for a single visual only
1037+
}
1038+
}
1039+
]
1040+
}
1041+
};
1042+
1043+
// Get a reference to the embedded report HTML element
1044+
var embedContainer = $('#embedContainer')[0];
1045+
1046+
// Get a reference to the embedded report.
1047+
report = powerbi.get(embedContainer);
1048+
1049+
// Update the settings by passing in the new settings you have configured.
1050+
report.updateSettings(newSettings)
1051+
.then(function () {
1052+
Log.log("Visual header was successfully hidden for 'Total Sales Variance by FiscalMonth and District Manager' visual.");
1053+
})
1054+
.catch(function (error) {
1055+
Log.log(errors);
1056+
});
1057+
1058+
}
1059+
9511060
function _Report_FullScreen() {
9521061
// Get a reference to the embedded report HTML element
9531062
var embedContainer = $('#embedContainer')[0];

demo/v2-demo/scripts/step_embed.js

+12
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ function Report_ApplyCustomLayout() {
5959
SetCode(_Report_ApplyCustomLayout);
6060
}
6161

62+
function Report_HideAllVisualHeaders() {
63+
SetCode(_Report_HideAllVisualHeaders);
64+
}
65+
66+
function Report_ShowAllVisualHeaders() {
67+
SetCode(_Report_ShowAllVisualHeaders);
68+
}
69+
70+
function Report_HideSingleVisualHeader() {
71+
SetCode(_Report_HideSingleVisualHeader);
72+
}
73+
6274
// ---- Page Operations ----------------------------------------------------
6375

6476
function Page_SetActive() {

demo/v2-demo/settings_interact_report.html

+4
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,14 @@
5454
</ul>
5555
<li id="layout-operations" onclick="OpenLayoutOperations();"><a href="#">Layout</a>
5656
<span class="tryShowcase" onclick="OpenLayoutOperations();onShowcaseTryMeClicked('CustomLayout');">(<span class="tryMeText">Showcase</span> <img src="images/tab_out.svg">)</span>
57+
<div class="highlightSection"></div>
5758
</li>
5859
<ul id="layout-operations-ul" class="function-ul" style="display: none;">
5960
<li onclick="Report_ApplyCustomLayout()" class="hideOnMobile hideOnReportCreate"><a href="#">Apply custom Layout</a></li>
6061
<li onclick="Page_HasLayout()"><a href="#">Check layout</a></li>
62+
<li onclick="Report_HideAllVisualHeaders()" class="hideOnMobile hideOnReportCreate"><a href="#">Hide all visual headers</a><div class="newFeature">NEW</div></li>
63+
<li onclick="Report_ShowAllVisualHeaders()" class="hideOnMobile hideOnReportCreate"><a href="#">Show all visual headers</a><div class="newFeature">NEW</div></li>
64+
<li onclick="Report_HideSingleVisualHeader()" class="hideOnMobile hideOnReportCreate"><a href="#">Hide single visual header</a><div class="newFeature">NEW</div></li>
6165
</ul>
6266
<li id="bookmarks-operations" onclick="OpenBookmarksOperations();" class="hideOnMobile"><a href="#">Bookmarks</a>
6367
<span class="tryShowcase" onclick="OpenBookmarksOperations();onShowcaseTryMeClicked('Bookmarks');">(<span class="tryMeText">Showcase</span> <img src="images/tab_out.svg">)</span>

0 commit comments

Comments
 (0)