0002-grid_cell__init_form-less-jquery-DOM-selector.patch
combo/manager/static/js/combo.manager.js | ||
---|---|---|
471 | 471 |
}, |
472 | 472 |
// Grid cell methods |
473 | 473 |
grid_cell__init_form: function() { |
474 |
const _self = this; |
|
474 | 475 |
this.grid_cell_form.varname = this.grid_cell_form[0]; |
475 | 476 |
this.grid_cell_form.template = this.grid_cell_form[1]; |
476 | 477 |
this.grid_cell_form.display_mode = this.grid_cell_form[2]; |
... | ... | |
492 | 493 | |
493 | 494 |
// hide or show template, change mode options, depending on selected field |
494 | 495 |
const _label_and_value_option = this.grid_cell_form.display_mode[0]; |
495 |
$(document).on('change', 'select[name="card_field_varname"]', function() {
|
|
496 |
$(varname_select).on('change', function() {
|
|
496 | 497 |
if ($(this).val() == '@custom@') { |
497 |
$('input[name="card_field_template"]').parent().show();
|
|
498 |
$('select[name="display_mode"] option[value="label-and-value"]').remove();
|
|
498 |
$(_self.grid_cell_form.template).parent().show();
|
|
499 |
$(_label_and_value_option).remove();
|
|
499 | 500 |
} else { |
500 |
$('input[name="card_field_template"]').parent().hide();
|
|
501 |
$(_label_and_value_option).prependTo($('select[name="display_mode"]'));
|
|
501 |
$(_self.grid_cell_form.template).parent().hide();
|
|
502 |
$(_label_and_value_option).prependTo($(_self.grid_cell_form.display_mode));
|
|
502 | 503 |
} |
503 | 504 |
}); |
504 | 505 |
}, |
... | ... | |
508 | 509 |
modal: true, |
509 | 510 |
width: 'auto', |
510 | 511 |
open: function( event, ui ) { |
511 |
$('select[name="card_field_varname"]').change();
|
|
512 |
$(_self.grid_cell_form.varname).change();
|
|
512 | 513 |
}, |
513 | 514 |
buttons: [ |
514 | 515 |
{ |
515 |
- |