Make the particular row particular fields read only in child table

Is that possible to make the particular fields in child table for particular row??

@Praveenkumar Please check this code with change your field name and child_table name


frm.fields_dict.items.grid.get_field('**child_table_field_name**').get_query = function(doc, cdt, cdn) {
                var row = locals[cdt][cdn];
                if (row.item_code) {
                   cur_frm.fields_dict.child_table.grid.grid_rows[row_no].docfields[field_idx].read_only=1
cur_frm.fields_dict.child_table.grid.refresh()
                }
            };
2 Likes

$(frm.wrapper).on(ā€˜grid-row-renderā€™, function(e, grid_row) {
if(grid_row.grid.df.fieldname==ā€œchild_table_field_nameā€){
if(grid_row.doc.field_name_in_child_table==ā€œCompletedā€) {
grid_row.wrapper.one(ā€˜focusā€™,ā€˜inputā€™,function(e){
grid_row.toggle_editable(ā€œfield_name_to_editableā€, false);
})
}
}
}

1 Like