Index: branches/5.1.x/core/admin_templates/js/grid.js =================================================================== diff -u -N -r12127 -r13545 --- branches/5.1.x/core/admin_templates/js/grid.js (.../grid.js) (revision 12127) +++ branches/5.1.x/core/admin_templates/js/grid.js (.../grid.js) (revision 13545) @@ -481,34 +481,31 @@ this.CheckDependencies('Grid.SetDependantToolbarButtons'); } -Grid.prototype.CheckDependencies = function($called_from) -{ -// alert('prefix: ' + this.prefix + '; ' + $called_from + ' -> Grid.CheckDependencies'); +Grid.prototype.CheckDependencies = function($called_from, $run_now) { + if (!$run_now || $run_now === undefined) { + // schedule run via document.ready, so we manage to disable + // toolbar buttons after ToolBar class mass-enables them + var $me = this; + + $(document).ready( + function () { + $me.CheckDependencies($called_from, true); + } + ); + + return ; + } + var enabling = (this.CountSelected() > 0); + for (var i = 0; i < this.DependantButtons.length; i++) { - if (this.DependantButtons[i][0].match("portal:(.*)")) { - button_name = RegExp.$1; - if (toolbar) { - if (enabling == this.DependantButtons[i][1]) { - toolbar.enableButton(button_name, true); - } - else - { - toolbar.disableButton(button_name, true); - } - } + if (this.DependantButtons[i][2] == 1) { + this.ToolBar.SetEnabled(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); } else { - if (this.DependantButtons[i][2] == 1) { - this.ToolBar.SetEnabled(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); - } - else { - this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); - } + this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); } } - //if (enabling) this.ClearAlternativeGridsSelection('Grid.CheckDependencies'); - } Grid.prototype.ClearAlternativeGridsSelection = function (called_from)