Skip to content

Commit 3b45f37

Browse files
ability to pass any MDX from GUI in the example
1 parent 0654dcc commit 3b45f37

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

example/index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
<a href="#8" onclick="window.location.reload(true);">8</a>
3030
</div>
3131
<div id="mdx"></div>
32+
<form id="mdxForm" onsubmit="return false;">
33+
<label>
34+
<br/>Your MDX:<br/>
35+
<input id="yourMDX" type="text" style="width: 100%"/>
36+
</label>
37+
</form>
3238
<script type="text/javascript">
3339

3440
var mdxTo = document.getElementById("mdx"),
@@ -45,6 +51,20 @@
4551
"SELECT NON EMPTY [Product].[P1].[Product Category].Members ON 0,NON EMPTY [DateOfSale].[Actual].[YearSold].&[2010].children ON 1 FROM [HoleFoods] %FILTER [DateOfSale].[Actual].[YearSold].&[2010] %FILTER [Measures].[%COUNT]"
4652
][v];
4753

54+
if (location.hash.slice(1, 3) === "q=") {
55+
req = location.hash.slice(3);
56+
}
57+
58+
document.getElementById("mdxForm").addEventListener("submit", function () {
59+
60+
var yourMDX = document.getElementById("yourMDX").value;
61+
62+
window.location.hash = "#q=" + yourMDX;
63+
64+
window.location.reload(true);
65+
66+
});
67+
4868
mdxTo.innerHTML = "<b>MDX:</b> <i>" + req + "</i>";
4969

5070
var lp = new LightPivotTable({

0 commit comments

Comments
 (0)