cancel
Showing results for 
Search instead for 
Did you mean: 

Widget displaying differently in edit versus view mode

Jack_Machesky
9 - Travel Pro
9 - Travel Pro

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

1 ACCEPTED SOLUTION

DRay
Community Team Leader
Community Team Leader

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.

David Raynor (DRay)

View solution in original post

6 REPLIES 6

DRay
Community Team Leader
Community Team Leader

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.

David Raynor (DRay)

4 Widgets.png

1 widget with name.png

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(", "))
}
});"

DRay
Community Team Leader
Community Team Leader

Thank you @Jack_Machesky. I will do some digging and let you know what we find.

David Raynor (DRay)

DRay
Community Team Leader
Community Team Leader

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.

David Raynor (DRay)

DRay
Community Team Leader
Community Team Leader

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,

David Raynor (DRay)

Jack_Machesky
9 - Travel Pro
9 - Travel Pro

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