Home Analytics

Best way to add a selectable parameter to dashboards?

Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
This seems like something that the rest of you may have already attempted, so I am curious how you accomplished it.  I am thinking of creating a dashboard with several SQL charts that use bracketed params like "{{myParam}}", and I want users to be able to select the value for it and redraw the charts based on their selection.

My approach in my head is to create an HTML widget at the top of the page with a dropdown list, and have it add a querystring to the page for that param (refreshing the page, unless that can be avoided).  So if they chose "1" from a list, the url of the current page would be appended with ?myParam=1.

Is there a simpler, more elegant way of doing this, perhaps?

The benefits of doing something like this include not re-creating the same dashboard with different variables, letting the user quickly switch between views, and not cluttering the menu up with 50+ versions of essentially the same dashboard.  I would pursue this for any one of those reasons, let alone all of them.

Best Answers


  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    I'm trying to keep it as OOB as I can.  I have a couple custom pages and it is not only tedious to build them, but hard to explain to others how they are structured and how they work.

    Thanks for confirming what I suspected though.

    I'll proceed this way and see how it turns out!
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    I hit a snag with this.  Does the HTML widget ignore <script> tags?  It seems to be doing that for me.
  • Geoff_RossGeoff_Ross Cireson Consultant Super IT Monkey ✭✭✭✭✭
    Yes it does. Before I read your comment above, i was going to suggest a custom page. Go on, you know it'll be awesome!.

    In all seriousness, I can't think of another way, other than the hyperlinks already mentioned.

  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    I had quite a few plans for that HTML widget on some existing dashboards.  They were just smashed to little pieces with this news.  Ouch.

    If I could just trigger a change event on a dropdown list or textbox, that would be outstanding.  Is there any viable reason not to do this?

    A custom page is an option, but I would honestly rather write custom code that looks for these HTML widgets, interprets what is in them, injects what is needed, and essentially "fakes" the presence of actual functionality.  Do not mistake this as me saying that this is a good idea.  It is merely the best available that I am aware of.

    Is there, perhaps, an easy way to get dashboard widgets into a custom page, that I could teach someone with no coding experience?  If coding is necessary, then it all falls on me instead of being shared work.  :'(
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭

    So for lack of a simple/efficient way to construct a custom page that contains editable dashboard widgets, I have opted to add text "tokens" to an HTML widget and I have an observer that, if it finds one, will replace it with functional HTML/script.  I am actually surprised at how quickly and efficiently this runs, and I end up with what I wanted, just not anywhere close to the way that I wanted to get there.

    It is somewhat clunky compared to if I was able to put "real" HTML into the HTML widgets, but it works.  I also have to define my replacement HTML in a file so that means I have to schedule a release to make any changes.  However, it does work well in spite of all of this.
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Since I'm using a mutation observer, I'd like to be able to use document.getElementById since it performs much better than a querySelector or JQuery, but using the class might perform a little better than the text parsing I am doing now.  I will have to try that out and compare.
Sign In or Register to comment.