Resize widget in ServicePortal if another widget is hidden

Maki
Tera Expert

Hello everyone,

On the index page in the Service Portal, I have a container with two widgets (My Requests & My Approvals) in one row. In the Service Portal Designer, I've set the size for each column to 6 so that both widgets are displayed equally sized.

However, I would like the "My Requests" widget to be displayed across the full container width when the "My Approvals" widget is hidden.

"My Approvals" is already hidden when no records are available.
How can I change the width of the "My Requests" widget now?

I have already cloned the "My Requests" widget and added the following to the server script:

 

var grApprovals = new GlideRecord('sysapproval_approver');
grApprovals.addEncodedQuery('state=requested^approver='+gs.getUserID());
grApprovals.query();
data.showApproval = grApprovals.getRowCount() > 0;

 

 

2 REPLIES 2

jcmings
Mega Sage

I'm not actually sure if you can override the column width that you set in the portal designer. I have no idea if this will work, but if you put both widgets inside one size-12 column, and then manipulate the CSS to size/place them accordingly, you may be able to achieve this?

I have a different solution now. I've cloned 'My Request' widget (My Requests FullWidth) and placed it in a row below. Instead of hiding only 'My Approvals' when there are no records, I now also hide 'My Requests'.
Only the 'My Request FullWidth' widget remains visible.

If there is an approval record, I hide 'My Requests FullWidth'.