Export Button rendering/permission

Hi, i there any way to hide export button on a table from certain profiles?

or any security in profile?

Thx

That is not currently possible declaratively. 

I guess you could write some inline javascript that tested the user profile and applied a new CSS class to the table export button with the declaration  “display: hidden;” 

But that seems pretty hackish. 

Another option would be to use rendering conditions on two whole tables.  One with export,  one without.   But I can understand you’d be loathe to do that…  

I did this with permission sets, but then I also had to remove the checkbox column on the table which automatically gets added as the left most column. 

You add a PermissionSetAssignment model with conditions for each of the permission you want to test and a condition for the AssigneeId to match the running user Id attribute (my page uses other permission sets for other rendering conditions). 

Make an inline snippet on load with the following javascript (replace tableId with your actual tableId)

I remove the checkbox column instead of hiding it since I wasn’t allowing for any other row level actions (if you only hide it, the left side table border gets hidden as well).

I remove the export button instead of hiding it because I don’t want users who are looking for the export button to change the style attribute from display:none to another value which will allow them to add the button back to the page.

<br />$('#tableId')&#46;ready(function(){ &#47;&#47;name of your permission set var permissionToCheck = 'Export_Allowed__c' &#47;&#47;name of your model var permissionMod = skuid&#46;$M('Permissions'); var rows = permissionMod&#46;getRows(); var runningUserAllowed = false; &#47;&#47;if there's no row in the permission set model with the Permission set name, the user isn't assigned the permission for(var index in rows){ if(rows[index] &amp;&amp; rows[index]&#46;PermissionSetId &amp;&amp; rows[index]&#46;PermissionSet&#46;Name==permissionToCheck){ runningUserAllowed = true; } } &#47;&#47;remove check boxes in any case $("#tableId")&#46;find("[class*='rowselect']")&#46;closest('th,td')&#46;remove(); &#47;&#47;if the user doens't have the permission set assigned to them, hide the export&#46; if(!runningUserAllowed){ $("#tableId")&#46;find("&#46;nx-export-btn")&#46;remove(); } });<br />



Make sure your Permissions model is before the model of the table you are loading.

@Rob, you’re right this is hackish. If Skuid decides to change the CSS class name of the export button, this would have to be updated, and if the table gets re-rendered, this javascript would have to be run again. 

I added an idea for this

https://community.skuid.com/t/conditional-rendering-of-the-table-export-button

Rob you’re right it’s hackish. Too hakish. When I sorted on the columns, the entire table re-rendered. To use javascript for this I’d have had to watch for table changes which is too complex given the easy alternative. I used your second option and it worked fine. Trouble is I’ll have to make sure to keep the two tables in sync each time I update it.