All columns are set to read-only

Disabled_XXXXX_SubGridOnSelect: function (ExecutionContext) {
    let that = this;
    let objFormContext = ExecutionContext.getFormContext();
    let entObject = objFormContext.data.entity;
    entObject.attributes.forEach(function (attribute) {
            let allColumnControl = attribute.controls.get(0);
            allColumnControl.setDisabled(true);
        });
}

Set specified columns to read-only

Disabled_XXXXX_SubGridOnSelect: function (ExecutionContext) {
    let objFormContext = ExecutionContext.getFormContext();
    let entObject = objFormContext.data.entity;
    entObject.attributes.forEach(function (attribute) {
        let columnName = attribute.getName();
        if (
            columnName == "your field name 1" ||
            columnName == "your field name 2" ||
            columnName == "your field name 3" ||
            columnName == "your field name 4" ||
            columnName == "your field name 5" ||
            columnName == "your field name 6") {
            attribute.controls.get(0).setDisabled(true);
        }
    });
}

Binding

Open the form, select the editable subgrid, and bind the method to it (remember to check ‘Pass execution context as the first parameter’).

为可编辑子网格绑定Javascript