Forum Discussion

Jack_Machesky's avatar
Jack_Machesky
Cloud Apps
02-28-2024
Solved

Widget displaying differently in edit versus view mode

I have a few widgets on my dashboard that are only displaying correctly when I click into the edit mode on them. When I am viewing the whole dashboard, they are not appearing correctly. Any reason why this might be happening?

Thanks

  • DRay's avatar
    DRay
    03-07-2024

    Hello Jack_Machesky.

    The filter members are being read and then the value is assigned using jQuery during the widget.ready event, which doesn't fire unless the widget is rendered in the view mode and is ready on the dashboard. On top of that, the jQuery used to apply the text value looks for a certain class and then modifies the dom. That's the reason why the Edit mode is not showing the filtered member.

6 Replies

Replies have been turned off for this discussion
  • Hello Jack_Machesky,

    What kind of differences are you seeing? The first thing that came to mind is there are Dashboard filters that are affecting the data returned, but I need to know more to make a better evaluation.

    • Jack_Machesky's avatar
      Jack_Machesky
      Cloud Apps

      The widget shown in the block of 4 should be displaying the member name, and it does when I click in to edit mode. It does not show when I am out of edit mode. I am using the following script on the widget: "

      //======================== Configuration ================================
      var yourFilterTitle = "Member";
      //==========================================================================

      widget.on("ready", function(w, args) {

      var filterDetails;

      //Loop through all filters
      prism.activeDashboard.filters.$$items.forEach((itemFilter) => {

      //if the filter is cascaded
      if(itemFilter.isCascading == true){
      //loop through the levels
      for(var k=0; k<itemFilter.levels.length;k++){
      //If the filter title is equal to FilterName (the target filter)
      if(itemFilter.levels[k].title == yourFilterTitle){
      filterDetails = itemFilter.levels[k].filter
      }
      }
      }

      //If the filter is not cascaded:
      else{
      //If the filter title is equal to FilterName (the target filter)
      if(itemFilter.jaql.title == yourFilterTitle){
      filterDetails = itemFilter.jaql.filter
      }
      }
      });

      if(filterDetails.all === true) {
      $("#text-to-change").text(yourFilterTitle + ": All Members")
      }else if(filterDetails.exclude){
      $("#text-to-change").text(yourFilterTitle + ": NOT " + filterDetails.exclude.members.join(", "))
      } else {
      $("#text-to-change").text(yourFilterTitle + ": " + filterDetails.members.join(", "))
      }
      });"

  • Hi Jack_Machesky,

    I wanted to see if my reply was useful for you. Can you let me know if you need any more help with this?

    Thank you,

  • Sorry for the late response, but I am no longer facing this issue. Thank you.