multiEdit: Allow disabling fields per-row

If _hideFields array is passed with row item data, then field IDs
specified will be disabled, if they are custom button actions.
This commit is contained in:
Brian Federle 2012-08-10 10:40:33 -07:00
parent 7450abf36f
commit 0a0acfbf9e
2 changed files with 18 additions and 0 deletions

View File

@ -6799,6 +6799,15 @@ div.panel.ui-dialog div.list-view div.fixed-header {
text-shadow: 0px 1px #FFFFFF;
}
.multi-edit .disabled .button.custom-action {
/*+opacity:50%;*/
filter: alpha(opacity=50);
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
-moz-opacity: 0.5;
opacity: 0.5;
cursor: not-allowed;
}
.multi-edit .button.custom-action:hover {
background: #808080 url(../images/bg-gradients.png);
color: #FFFFFF;

View File

@ -176,6 +176,8 @@
$button.html(data && data[fieldName] && data[fieldName]['_buttonLabel'] ?
_l(data[fieldName]['_buttonLabel']) : _l(field.custom.buttonLabel));
$button.click(function() {
if ($td.hasClass('disabled')) return false;
var $button = $(this);
var context = $.extend(true, {},
options.context ?
@ -196,6 +198,8 @@
}
}
});
return true;
});
$button.appendTo($td);
}
@ -210,6 +214,11 @@
var targetWidth = $multi.find('th.' + fieldName).width() + 5;
$td.width(targetWidth);
if (data._hideFields &&
$.inArray(fieldName, data._hideFields) > -1) {
$td.addClass('disabled');
}
return true;
});