BUGFIX: Update the batch action select state also on load (os7304)

This approach should cover more situations than the previous one. It
will owrk regardless of the initial state in the HTML (which can be
loaded from deferred cache).
This commit is contained in:
Mateusz Uzdowski 2012-05-11 12:53:40 +12:00
parent b28a625f0b
commit 905115b4db

View File

@ -53,14 +53,26 @@
tree.removeClass('multiple'); tree.removeClass('multiple');
} }
// Batch actions only make sense when multiselect is enabled self._updateStateFromViewMode();
if(val == 'multiselect') dropdown.removeAttr('disabled').change();
else dropdown.attr('disabled', 'disabled').change();
}); });
self._updateStateFromViewMode();
this._super(); this._super();
}, },
/**
* Updates the select box state according to the current view mode.
*/
_updateStateFromViewMode: function() {
var viewMode = $('.cms-tree-view-modes :input[name=view-mode]:checked').val();
var dropdown = this.find(':input[name=Action]');
// Batch actions only make sense when multiselect is enabled.
if(viewMode == 'multiselect') dropdown.removeAttr('disabled').trigger("liszt:updated");
else dropdown.attr('disabled', true).trigger("liszt:updated");
},
/** /**
* Function: register * Function: register
* *