tval's avatar
tval
Icon for Advocate I rankAdvocate I
8 years ago
Status:
New

setSlicerState javascript method does not work

To see the error, just use the Power BI embedded demo site and try to set slicer filters.  Javascript error below. It didn't work most of last week, but then was working Friday.  Now doesn't work again.  I had posted in Developer forum, just re-posting in Issues area.

 

6 Comments

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Icon for Community Support rankCommunity Support

    Hi tval,

     

    Based on my test, we can workaround the issue by selecting any value in Manufacturer/Product/Region slicer then deselecting the value, run Set Slicer State code in sample report. 

     

    I will confirm if it's the same issue as listed in Support site. Will update here once I get any information. 

     

     

    Best Regards,
    Qiuyun Yu 

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Icon for Community Support rankCommunity Support

    Hi tval,

     

    I confirmed that this issue has the same root cause as the one listed in Support site. You can keep an eye on the status of the issue on Support site. 

     

    Best Regards,
    Qiuyun Yu 

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Icon for Community Support rankCommunity Support

    Hi tval,

     

    Please note that there are few workarounds available. Here are two of them:

    • Users can pass empty filters array in load config. this will solve the issue.
    • Users can call GetSlicerState on one slicer which is set. this will solve the issue as well.

    Best Regards,
    Qiuyun Yu 

  • Anonymous's avatar
    Anonymous
    Not applicable

    I came across an issue of my own while using setSlicerState:

     

    ERROR Error: Uncaught (in promise): Object: {"message":"visualConfigIsNotInitialized","detailedMessage":"Visual container config is not initialized"}

     

    I tried sending an empty filter array at report launch and calling getSlicerState as well; with no luck.

    getSLicerState throws me the very same error as setSlicerState.

     

    I'm getting the correct slicer visual (visual.type gets me 'slicer' result) through a cascade of 

    report.getPages() -> page.getVisuals()

     

    Any idea on what might cause this behavior ?

     

    Kind regards,

  • Anonymous's avatar
    Anonymous
    Not applicable
    At least temporarily this fixed the issue for me. Basically on the first set if it fails it tries again. I only got the error always on the first try so after that it works.
     
    visual.setSlicerState({
         filters: [basicFilter]
    }).catch(err => {
         visual.setSlicerState({
              filters: [basicFilter]
         });
    });
     
  • Any update on this? visual.getSlicerState() still seems to be throwing that error. None of the workarounds seem to work.