pav*_*van 0 tridion tridion-2011
我创建了带有两个ribbonitems的usercontrol,但它们出现在禁用模式下.
我尝试通过在我的js文件中为isAvailable和isEnabled函数发出警报来进行检查.
Extensions.DynamicControls.prototype.isAvailable =
function DynamicControls$isAvailable(selection)
{
alert('Inside DynamicControls isAvailable');
return true;
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,我没有在isAvailable函数中收到任何警报.
Extensions.DynamicControls.prototype.isEnabled =
function DynamicControls$isEnabled(selection)
{
alert('Inside DynamicControls isEnabled');
return true;
}
Run Code Online (Sandbox Code Playgroud)
我能够在isEnabled函数中获取警报.
请让我知道我需要启用它们.
除此之外,我已经看到使用firebug的页面源 - 在选择这两个创建的按钮usercontrol按钮时,我发现为什么默认应用该类?如果我尝试删除它,则启用按钮.
截至目前,这些只是作为功能区中的标签可见.是否还需要任何CSS使其看起来像任何其他按钮?请建议.
正如我对你上一个问题的回答所指出的那样,这些方法应该被调用,_isAvailable并且_isEnabled在它们前面加上一个下划线,这就是我猜你为什么不被解雇的原因.
因此,请尝试在JavaScript中使用以下代码:
Extensions.DynamicControls.prototype._isAvailable =
function DynamicControls$_isAvailable(selection, pipeline)
{
alert('Inside DynamicControls isAvailable');
if (pipeline) {
pipeline.stop = false;
}
return true;
}
Extensions.DynamicControls.prototype._isEnabled =
function DynamicControls$_isEnabled(selection, pipeline)
{
alert('Inside DynamicControls isEnabled');
if (pipeline) {
pipeline.stop = false;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
顺便说一句,看看你的命名空间Extensions.DynamicControls我想知道你是否正在制作正确的引用,Javascript不适用于你的ItemsGroup,它应该是针对特定的按钮,每个命令(如果你愿意的话,按钮)都有自己的位JavaScript的启用它并有一个_execute方法.有关详细信息,请参阅我对您的其他问题的回答.
CSS仅用于按钮的布局,这实际上不会启用或禁用它们.虽然如果将禁用的图像分配给启用状态,则外观可能是欺骗性的.
按钮的CSS看起来像:
/* large ribbon button image */
.tridion .ribbontoolbar .button.MyBtn .image,
.tridion .ribbontoolbar .button.MyBtn.ribbonitem .image
{
background-image: url({ThemePath}Images/my-btn-img.32x32.png);
}
.tridion .ribbontoolbar .button.MyBtn.ribbonitem.disabled .image
{
background-image: url({ThemePath}Images/my-btn-img.32x32.gray.png);
}
/* small ribbon button image */
.tridion .contextmenu .item.MyBtn .image,
.tridion .ribbontoolbar.minimized .button.MyBtn .image,
.tridion .ribbontoolbar.minimized .button.MyBtn.ribbonitem .image
{
background-image: url({ThemePath}Images/my-btn-img.16x16.png);
}
.tridion .ribbontoolbar.minimized .button.MyBtn.ribbonitem.disabled .image
{
background-image: url({ThemePath}Images/my-btn-img.16x16.gray.png);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
161 次 |
| 最近记录: |