wcs: custom card, reset form when adding a cell (#68807)
gitea-wip/combo/pipeline/head Build started... Details
gitea/combo/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Lauréline Guérin 2022-09-09 08:55:46 +02:00
parent 29e4f084d3
commit 7a11f2ff8f
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
1 changed files with 13 additions and 0 deletions

View File

@ -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