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

Notifications

Announcements

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:
I have the same question (0)
  • Verified answer
    Shashank Bhide Profile Picture
    942 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard