wcs: custom card, reset form when adding a cell (#68807)
This commit is contained in:
parent
29e4f084d3
commit
7a11f2ff8f
|
@ -828,6 +828,18 @@ Card_cell_custom.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
grid_cell__add_set_fields: function(grid_cell) {
|
||||
// reset values
|
||||
$(this.grid_cell_form).find('select').each(function(i, el) {
|
||||
$(el).find('option:selected').prop("selected", false);
|
||||
$(el).find('option:first').prop("selected", true);
|
||||
$(el).change();
|
||||
});
|
||||
$(this.grid_cell_form).find('input, textarea').each(function(i, el) {
|
||||
$(el).val('');;
|
||||
$(el).change();
|
||||
});
|
||||
},
|
||||
grid_cell__edit: function(grid_cell) {
|
||||
this.grid_cell__edit_set_fields(grid_cell);
|
||||
const cell_id = $(grid_cell).index();
|
||||
|
@ -947,6 +959,7 @@ Card_cell_custom.prototype = {
|
|||
})
|
||||
// Add grid cell Btn click
|
||||
$(this.add_grid_cell_btn).on('click', function() {
|
||||
_self.grid_cell__add_set_fields();
|
||||
_self.grid_cell__form_dialog(gettext('Add'), _self.grid_cell__add_schema.bind(_self));
|
||||
});
|
||||
// Grid cells sortable
|
||||
|
|
Loading…
Reference in New Issue