web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Hide Show Delete Butto...
Power Pages
Unanswered

Hide Show Delete Button in SharePointDocumentLocation Subgrid

(0) ShareShare
ReportReport
Posted on by 1,510

Hi,

 

I want to hide/show Delete button based on condition in subgrid(SharePoint Document Location).

hardikv_0-1636309182758.png

I have tried the below JS code to hide button, but it won't work.

 

 

var entityGridDocument = $(".subgrid.sharepoint-grid").eq(0);
//var entityGridDocument = $(".entity-grid.subgrid").eq(0); Tried this as well
entityGridDocument.on("loaded", function () {
	entityGridDocument.find("table tbody > tr").each(function(index, tr) {
		if(myStatus == "1")
		{
			$(tr).find('.btn.btn-default.btn-xs').hide();
		}
	});	
});

 

 

I have also tried to add Basic Form Metadata as Subgrid and add Filter Criteria for Delete Button. But it didn't work.

Categories:
  • H V Profile Picture
    1,510 on at

    Hello Experts @ragavanrajan @OliverRodrigues @Mira_Ghaly @OOlashyn 

     

    Is there any way to hide/show Delete Button based on specific condition in SharePointDocumentLocation Subgrid?

     

    Thanks.

  • ragavanrajan Profile Picture
    7,044 Most Valuable Professional on at

    Hi @hardikv 

     

    I am having a hard time firing the SharePoint subgrid on load event. Meanwhile, I am not sure this will help. Try the following approach 

     

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/145596/hide-delete-button-from-sub-grid/324040 

     

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • H V Profile Picture
    1,510 on at

    Hi @v-bofeng-msft 

     

    Could you please help me?

  • oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    sorry about the delay @hardikv 

    did you get this sorted? I don't have a trial with SharePoint here but can try to get that and take a look

  • H V Profile Picture
    1,510 on at

    Hi @OliverRodrigues 

     

    Thanks for your reply. 

     

    No it is not resolved yet. If you can help me, it would be great.

  • oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    @hardikv I've been trying to figure this one out for a few weeks now .. it seems the SharePoint subgrid is not rendered the same way as regular subgrids.. it's using JS Handlebars for that.. I tried many many ways to inject JS there, but I can't get it to work using JS 😢

     

    Good news here is that I managed (or kind of) to get this working with CSS.. you mentioned earlier you need to this conditionally, what would be the condition? is that something outside the SharePoint subgrid context or within that context? 

     

    For example, if you want to hide the button based on the extension, I managed to get this working by using this CSS in the Web Page level:

    .table > tbody > tr[data-filename*=".txt"] > td[aria-label="action menu"] {
     display: none;
    }

    You can add Liquid code to that CSS area as far as I know, so if you have an external variable where you can identify the condition, you might be able to use similar logic.. I hope this makes sense

     

    Please let me know if this works and what's exactly your scenario, I might write a blog post after all the time I wasted trying to the get JS working 🤣

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Pages

#1
M Bilal Khan Profile Picture

M Bilal Khan 139

#2
Mohsin Ali Profile Picture

Mohsin Ali 41

#3
11manish Profile Picture

11manish 21 Super User 2026 Season 2

Last 30 days Overall leaderboard