mirror of https://github.com/apache/cloudstack.git
multiEdit: extend field hide/show functionality
-Support passing isHidden option as closure, for conditional hide/show based on context -Adds new option format for isHidden option: return false == show field and all columns (default) return true == hide only header and form column return 2 == hide header and form, as well as returned item column -- these item columns will be skipped over entirely, not just hidden
This commit is contained in:
parent
ac04a9f2e1
commit
599dd1a6e6
|
|
@ -3368,6 +3368,12 @@
|
|||
requireValidation: true,
|
||||
buttonLabel: 'label.configure',
|
||||
action: cloudStack.uiCustom.autoscaler(cloudStack.autoscaler)
|
||||
},
|
||||
isHidden: function(args) {
|
||||
// return 2 == hide header and form, as well as returned item column
|
||||
// return 2;
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,12 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
var isHidden = $multi.find('th.' + fieldName).hasClass('always-hide');
|
||||
|
||||
if (isHidden) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var $td = $('<td>').addClass(fieldName).appendTo($tr);
|
||||
var $input, val;
|
||||
var $addButton = $multi.find('form .button.add-vm:not(.custom-action)').clone();
|
||||
|
|
@ -264,7 +270,7 @@
|
|||
|
||||
// Align width to main header
|
||||
_medit.refreshItemWidths($multi);
|
||||
|
||||
|
||||
if (data._hideFields &&
|
||||
$.inArray(fieldName, data._hideFields) > -1) {
|
||||
$td.addClass('disabled');
|
||||
|
|
@ -891,7 +897,16 @@
|
|||
$td.attr('rel', fieldName);
|
||||
$td.appendTo($inputForm);
|
||||
|
||||
if (field.isHidden) {
|
||||
var isHidden = $.isFunction(field.isHidden) ?
|
||||
field.isHidden({ context: context }) : field.isHidden;
|
||||
|
||||
if (isHidden) {
|
||||
// return true == hide only header and form column
|
||||
// return 2 == hide header and form, as well as returned item column
|
||||
if (isHidden === 2) {
|
||||
$th.addClass('always-hide');
|
||||
}
|
||||
|
||||
$th.hide();
|
||||
$td.hide();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue