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 Apps / Can I make a column in...
Power Apps
Answered

Can I make a column in an Editable SubGrid read-only?

(0) ShareShare
ReportReport
Posted on by 27
Is there a way to make a specific column in an Editable SubGrid read-only in Power Apps? I have five columns total, four of which need to be editable, but one of them (specifically the first column, a lookup field) should be read-only. I’m looking for a solution that allows only that column to be non-editable without affecting the editability of the others.
 
Here is my current JS that filters the Editable SubGrid based on the current entity's ID, but I want to add to it to make the first column read-only:
function OnLoad(executionContext) {
    "use strict";
    var formContext = executionContext.getFormContext(); // Get Form Context
    var tabContext = formContext.ui.tabs.get("tab_a"); 

    tabContext.addTabStateChange(filterSubgrid);
    filterSubgrid(executionContext);
}

function filterSubgrid(executionContext) {
    var formContext = executionContext.getFormContext();
    var Id = formContext.data.entity.getId(); 
    var subgrid = formContext.getControl("Subgrid_S"); 

    if (subgrid) {
        var fetchXml;

        if (Id != null) {
            fetchXml = "<fetch version='1.0' mapping='logical' distinct='true'>"
                     +     "<entity name='...'>"
                     +         "<attribute name='...'/>"
                     +         "<filter type='and'>"
                     +             "<condition attribute='...' operator='eq' value='" + Id + "' uiname='' uitype='...' />"
                     +         "</filter>"
                     +     "</entity>"
                     + "</fetch>";
        }

        // Set the fetchXml to the subgrid
        subgrid.setFilterXml(fetchXml);
        subgrid.refresh();

    }
}
Categories:
  • Verified answer
    Shashank Bhide Profile Picture
    946 Moderator on at
    I've not tried, but the answer seems to be yes.
     
    The gridcell class does support setDisabled method.
     
     

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 Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard