Merge pull request #4133 from mbauskar/grid
[minor] don't setup checkbox if the childtable is read_only
This commit is contained in:
commit
8a2b91b79e
2 changed files with 11 additions and 2 deletions
|
|
@ -170,8 +170,9 @@ frappe.ui.form.Grid = Class.extend({
|
|||
} else {
|
||||
// redraw
|
||||
var _scroll_y = $(document).scrollTop();
|
||||
|
||||
this.make_head();
|
||||
// to hide checkbox if grid is not editable
|
||||
this.header_row && this.header_row.toggle_check();
|
||||
|
||||
if(!this.grid_rows) {
|
||||
this.grid_rows = [];
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ frappe.ui.form.GridRow = Class.extend({
|
|||
init: function(opts) {
|
||||
this.on_grid_fields_dict = {};
|
||||
this.on_grid_fields = [];
|
||||
this.row_check_html = '<input type="checkbox" class="grid-row-check pull-left">';
|
||||
this.columns = {};
|
||||
this.columns_list = [];
|
||||
$.extend(this, opts);
|
||||
this.row_check_html = '<input type="checkbox" class="grid-row-check pull-left">';
|
||||
this.make();
|
||||
},
|
||||
make: function() {
|
||||
|
|
@ -121,6 +121,8 @@ frappe.ui.form.GridRow = Class.extend({
|
|||
if(this.grid_form) {
|
||||
this.grid_form.layout && this.grid_form.layout.refresh(this.doc);
|
||||
}
|
||||
|
||||
this.toggle_check();
|
||||
},
|
||||
render_template: function() {
|
||||
this.set_row_index();
|
||||
|
|
@ -592,4 +594,10 @@ frappe.ui.form.GridRow = Class.extend({
|
|||
toggle_editable: function(fieldname, editable) {
|
||||
this.set_field_property(fieldname, 'read_only', editable ? 0 : 1);
|
||||
},
|
||||
toggle_check: function() {
|
||||
// to hide checkbox if grid is not editable
|
||||
this.wrapper
|
||||
.find('.grid-row-check')
|
||||
.css("display", this.grid.is_editable()? 'block':'none');
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue