Skip to content

File tree

10 files changed

+203
-108
lines changed

10 files changed

+203
-108
lines changed

demo/v2-demo/scripts/codesamples.js

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,10 +1717,10 @@ function _Visual_GetFilters() {
17171717

17181718
visual.getFilters()
17191719
.then(function (filters) {
1720-
Log.log(filters);
1720+
Log.log(filters);
17211721
})
17221722
.catch(function (errors) {
1723-
Log.log(errors);
1723+
Log.log(errors);
17241724
});
17251725
})
17261726
.catch(function (errors) {
@@ -1758,7 +1758,7 @@ function _Visual_RemoveFilters() {
17581758

17591759
visual.removeFilters()
17601760
.catch(function (errors) {
1761-
Log.log(errors);
1761+
Log.log(errors);
17621762
});
17631763
})
17641764
.catch(function (errors) {
@@ -1768,4 +1768,94 @@ function _Visual_RemoveFilters() {
17681768
.catch(function (errors) {
17691769
Log.log(errors);
17701770
});
1771+
}
1772+
1773+
function _Visual_ExportData_Summarized() {
1774+
// Get models. models contains enums that can be used.
1775+
var models = window['powerbi-client'].models;
1776+
1777+
// Get a reference to the embedded report HTML element
1778+
var embedContainer = $('#embedContainer')[0];
1779+
1780+
// Get a reference to the embedded report.
1781+
report = powerbi.get(embedContainer);
1782+
1783+
// Retrieve the page collection and get the visuals for the first page.
1784+
report.getPages()
1785+
.then(function (pages) {
1786+
1787+
// Retrieve active page.
1788+
var activePage = pages.find(function(page) {
1789+
return page.isActive
1790+
});
1791+
1792+
activePage.getVisuals()
1793+
.then(function (visuals) {
1794+
1795+
// Retrieve the wanted visual.
1796+
var visual = visuals.find(function(visual) {
1797+
return visual.name == "VisualContainer3";
1798+
});
1799+
1800+
// Exports visual data
1801+
visual.exportData(models.ExportDataType.Summarized)
1802+
.then(function (data) {
1803+
Log.log(data);
1804+
})
1805+
.catch(function (errors) {
1806+
Log.log(errors);
1807+
});
1808+
})
1809+
.catch(function (errors) {
1810+
Log.log(errors);
1811+
});
1812+
})
1813+
.catch(function (errors) {
1814+
Log.log(errors);
1815+
});
1816+
}
1817+
1818+
function _Visual_ExportData_Underlying() {
1819+
// Get models. models contains enums that can be used.
1820+
var models = window['powerbi-client'].models;
1821+
1822+
// Get a reference to the embedded report HTML element
1823+
var embedContainer = $('#embedContainer')[0];
1824+
1825+
// Get a reference to the embedded report.
1826+
report = powerbi.get(embedContainer);
1827+
1828+
// Retrieve the page collection and get the visuals for the first page.
1829+
report.getPages()
1830+
.then(function (pages) {
1831+
1832+
// Retrieve active page.
1833+
var activePage = pages.find(function(page) {
1834+
return page.isActive
1835+
});
1836+
1837+
activePage.getVisuals()
1838+
.then(function (visuals) {
1839+
1840+
// Retrieve the wanted visual.
1841+
var visual = visuals.find(function(visual) {
1842+
return visual.name == "VisualContainer3";
1843+
});
1844+
1845+
// Exports visual data
1846+
visual.exportData(models.ExportDataType.Underlying)
1847+
.then(function (data) {
1848+
Log.log(data);
1849+
})
1850+
.catch(function (errors) {
1851+
Log.log(errors);
1852+
});
1853+
})
1854+
.catch(function (errors) {
1855+
Log.log(errors);
1856+
});
1857+
})
1858+
.catch(function (errors) {
1859+
Log.log(errors);
1860+
});
17711861
}

demo/v2-demo/scripts/report.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,39 +104,34 @@ function OpenInteractStep() {
104104
$("#settings").load("settings_interact_tile.html", function() {
105105
SetToggleHandler("tile-operations-div");
106106
LoadCodeArea("#embedCodeDiv", "");
107-
AddImgToNewOperations();
108107
});
109108
}
110109
else if (entityType == EntityType.Dashboard)
111110
{
112111
$("#settings").load("settings_interact_dashboard.html", function() {
113112
SetToggleHandler("operation-categories");
114113
LoadCodeArea("#embedCodeDiv", "");
115-
AddImgToNewOperations();
116114
});
117115
}
118116
else if (entityType == EntityType.Qna)
119117
{
120118
$("#settings").load("settings_interact_qna.html", function() {
121119
SetToggleHandler("operation-categories");
122120
LoadCodeArea("#embedCodeDiv", "");
123-
AddImgToNewOperations();
124121
});
125122
}
126123
else if (entityType == EntityType.Visual)
127124
{
128125
$("#settings").load("settings_interact_visual.html", function() {
129126
SetToggleHandler("operation-categories");
130127
LoadCodeArea("#embedCodeDiv", "");
131-
AddImgToNewOperations();
132128
});
133129
}
134130
else
135131
{
136132
$("#settings").load("settings_interact_report.html", function() {
137133
SetToggleHandler("operation-categories");
138134
LoadCodeArea("#embedCodeDiv", "");
139-
AddImgToNewOperations();
140135
});
141136
}
142137
}

demo/v2-demo/scripts/step_embed.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function Visual_DataSelected() {
190190
SetCode(_Visual_DataSelected);
191191
}
192192

193-
// ---- Visual Level Filters ------------------------------------------------------
193+
// ---- Visuals -------------------------------------------------------------------
194194

195195
function Visual_GetFilters() {
196196
SetCode(_Visual_GetFilters);
@@ -203,3 +203,11 @@ function Visual_SetFilters() {
203203
function Visual_RemoveFilters() {
204204
SetCode(_Visual_RemoveFilters);
205205
}
206+
207+
function Visual_ExportData_Summarized() {
208+
SetCode(_Visual_ExportData_Summarized);
209+
}
210+
211+
function Visual_ExportData_Underlying() {
212+
SetCode(_Visual_ExportData_Underlying);
213+
}

demo/v2-demo/scripts/step_interact.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ function OpenEditSaveOperations() {
88
$("#editsave-operations").toggleClass("active");
99
}
1010

11-
function OpenEventsOperations() {
12-
$("#events-operations-ul").toggle();
13-
$("#events-operations").toggleClass("active");
11+
function OpenDataOperations() {
12+
$("#data-operations-ul").toggle();
13+
$("#data-operations").toggleClass("active");
1414
}
1515

1616
function OpenExtensionsOperations() {
1717
$("#extensions-operations-ul").toggle();
1818
$("#extensions-operations").toggleClass("active");
1919
}
2020

21-
function OpenReportEntitiesOperations() {
22-
$("#reportentities-operations-ul").toggle();
23-
$("#reportentities-operations").toggleClass("active");
21+
function OpenReportPropertiesOperations() {
22+
$("#reportproperties-operations-ul").toggle();
23+
$("#reportproperties-operations").toggleClass("active");
2424
}
2525

2626
function OpenFiltersOperations() {
@@ -43,19 +43,19 @@ function OpenNavigationOperations() {
4343
$("#navigation-operations").toggleClass("active");
4444
}
4545

46-
function OpenVisualEventsOperations() {
47-
$("#visual-events-operations-ul").toggle();
48-
$("#visual-events-operations").toggleClass("active");
46+
function OpenVisualDataOperations() {
47+
$("#visual-data-operations-ul").toggle();
48+
$("#visual-data-operations").toggleClass("active");
4949
}
5050

5151
function OpenDashboardGeneralOperations() {
5252
$("#dashboard-general-operations-ul").toggle();
5353
$("#dashboard-general-operations").toggleClass("active");
5454
}
5555

56-
function OpenDashboardEntitiesOperations() {
57-
$("#dashboard-entities-operations-ul").toggle();
58-
$("#dashboard-entities-operations").toggleClass("active");
56+
function OpenDashboardPropertiesOperations() {
57+
$("#dashboard-properties-operations-ul").toggle();
58+
$("#dashboard-properties-operations").toggleClass("active");
5959
}
6060

6161
function OpenDashboardEventsOperations() {

demo/v2-demo/scripts/utils.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,6 @@ function ClearTextArea(textAreaSelector) {
9696
$(textAreaSelector).val("");
9797
}
9898

99-
function AddImgToNewOperations(){
100-
var newListItems = $('.newOperation');
101-
newListItems.each(function(index, value)
102-
{
103-
var spanElement = document.createElement("span");
104-
spanElement.innerText = value.innerText;
105-
106-
var newImgElement = document.createElement("img");
107-
newImgElement.src = "images\\new.svg";
108-
109-
value.innerText = '';
110-
value.appendChild(spanElement);
111-
value.appendChild(newImgElement);
112-
113-
});
114-
}
115-
11699
function getEmbedContainerID(entityType) {
117100
switch (entityType) {
118101
case EntityType.Visual:

demo/v2-demo/settings_interact_dashboard.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
<div id="wrapper-operations-div" class="operations-div">
66
<div id="operation-categories" class="operations-div">
77
<ul class="operations-ul">
8-
<li id="dashboard-entities-operations" onclick="OpenDashboardEntitiesOperations();"><a href="#">Dashboard Entities</a></li>
9-
<ul id="dashboard-entities-operations-ul" class="function-ul" style="display: none;">
8+
<li id="dashboard-general-operations" onclick="OpenDashboardGeneralOperations();"><a href="#">General Operations</a></li>
9+
<ul id="dashboard-general-operations-ul" class="function-ul" style="display: none;">
10+
<li onclick="Dashboard_FullScreen()"><a href="#">Full screen</a></li>
11+
<li onclick="Dashboard_ExitFullScreen()"><a href="#">Exit full screen</a></li>
12+
</ul>
13+
<li id="dashboard-properties-operations" onclick="OpenDashboardPropertiesOperations();"><a href="#">Properties</a></li>
14+
<ul id="dashboard-properties-operations-ul" class="function-ul" style="display: none;">
1015
<li onclick="Dashboard_GetId()"><a href="#">Get ID</a></li>
1116
</ul>
1217
<li id="dashboard-events-operations" onclick="OpenDashboardEventsOperations();"><a href="#">Events</a></li>
1318
<ul id="dashboard-events-operations-ul" class="function-ul" style="display: none;">
1419
<li onclick="DashboardEvents_TileClicked()"><a href="#">Tile clicked</a></li>
1520
</ul>
16-
<li id="dashboard-general-operations" onclick="OpenDashboardGeneralOperations();"><a href="#">General Operations</a></li>
17-
<ul id="dashboard-general-operations-ul" class="function-ul" style="display: none;">
18-
<li onclick="Dashboard_FullScreen()"><a href="#">Full screen</a></li>
19-
<li onclick="Dashboard_ExitFullScreen()"><a href="#">Exit full screen</a></li>
20-
</ul>
2121
</ul>
2222
</div>
2323
</div>

0 commit comments

Comments
 (0)