How to set the value of a widget filter

Comments

4 comments

  • Avatar
    Ben Sadan

    Hi Brian Wetzel

    the function you should use is:

    mySisenseApp.dashboard.$$model.filters.update(data.filter, data.options);

    while the mySisenseApp.dashboard is the dash object created with sisense.js.

    data should look something like this:

    0
    Comment actions Permalink
  • Avatar
    Stefan Kirov

    Hi, I tried this and it does not change the widget filter. Also I do not see the widget filter inside any of the

    mySisenseApp.dashboard.$$model.filters or mySisenseApp.dashboard.$$filters.$$filters 

    objects. Is there anything that I could be missing? 

    I can see the filter in the widget filter passed through the JAQL back to sisense, but cannot find out how to modify it. Just need to change it's members. 

     

    Thanks

    0
    Comment actions Permalink
  • Avatar
    Ben Sadan

    Hi Stefan Kirov,

    you can use

    widget.on('beforequery', function process(widget, event) {...

    in order to catch the widget right before the query is executed, then you can look at

    event.query.metadata

    in order to see the dimensions, values and filters that are being used, if you cannot see the filter there it may be disabled on the widget, check the widget editing window in the webapp and is if the filter is disabled/dashboard filters are disabled for the specific widget.

    you can also use the before query event to change the values as you wish!

    hope this helps!

    0
    Comment actions Permalink
  • Avatar
    Stefan Kirov

    Thanks Ben! I am using the widget.on event and it works this way. 

    0
    Comment actions Permalink

Please sign in to leave a comment.