Quantcast
Channel: Power Query topics
Viewing all articles
Browse latest Browse all 31059

slicer javascript API help

$
0
0

I'm attempting to set a slicer value upon load leveraging the App Owns Data example. however I cant seem to get it to work using setSlicerState(filter).

 

 

 

i've tried to create a slicerstate object and update it using the setSlicerState function, however am getting an error :

DOMException: Failed to execute 'postMessage' on 'Window': #<Promise> could not be cloned



See my code below:

 

        report.getPages()
         .then(function (pages) {
             //go to page 5 and get slicer visual
             testPage = pages[5];
             testPage.getVisuals()
               .then(function (visuals) {
                   testSlicer = visuals[0];
                   //get slicer state object
                   testState = testSlicer.getSlicerState();
               }).catch(function (errors) {
                   console.log(errors);
               });
         });


        report.getPages()
         .then(function (pages) {
             // Retrieve page 4
             testPage = pages[4];
             //go to page 4
             testPage.getVisuals()
               .then(function (visuals) {
                   testSlicer = visuals[2];
                   //Set slicer state to value from previous visual
                   testState = testSlicer.setSlicerState(testState);
               }).catch(function (errors) {
                   console.log(errors);
               });
         });

Has anyone had experience with this? or am able to point me in the right direction?

 

Thanks


Viewing all articles
Browse latest Browse all 31059

Trending Articles