使用 Custom_AddDocLibMenuItems 的 SPDocumentLibrary 菜单项的顺序
我正在将自定义上下文菜单项添加到 SharePoint 中 SPDocumentLibrary 列表中的文档(而不是文件夹)。以下代码有效,但总是在上下文菜单的顶部添加我的自定义菜单项,这是我不想要的。我猜测 CAMOpt 中的最后一个参数是一个定义顺序的序列号,但它似乎没有任何效果。有谁知道是否可以将自定义上下文菜单项添加到列表底部?
function Custom_AddDocLibMenuItems(m, ctx) {
var otype = currentItemFSObjType = GetAttributeFromItemTable(itemTable, "OType", "FSObjType");
if (otype != 1) {
var itemId = GetAttributeFromItemTable(itemTable, "ItemId", "Id");
var listId = ctx.listName;
var action = 'Go_To_Page("' + ctx.HttpRoot + '/_layouts/custom/PAGES/mycustompage.aspx?ListId=' + listId + '&ListItemID=' + itemId + ');';
CAMOpt(m, 'Custom Menu Item', action, '/_layouts/custom/IMAGES/action.gif', '', 110);
CAMSep(m);
}
return false;
}
function Go_To_Page(page) {
window.location = page;
}
I'm adding a custom context menu item to documents (and not folders) in a SPDocumentLibrary list in SharePoint. The following code works, but always adds my custom menu item at the top of the context menu, which I don't want. I was guessing that the final parameter in CAMOpt was a sequence number that would define the order, but it doesn't seem to have any effect. Does anyone know if it's possible to add a custom context menu item to the bottom on the list?
function Custom_AddDocLibMenuItems(m, ctx) {
var otype = currentItemFSObjType = GetAttributeFromItemTable(itemTable, "OType", "FSObjType");
if (otype != 1) {
var itemId = GetAttributeFromItemTable(itemTable, "ItemId", "Id");
var listId = ctx.listName;
var action = 'Go_To_Page("' + ctx.HttpRoot + '/_layouts/custom/PAGES/mycustompage.aspx?ListId=' + listId + '&ListItemID=' + itemId + ');';
CAMOpt(m, 'Custom Menu Item', action, '/_layouts/custom/IMAGES/action.gif', '', 110);
CAMSep(m);
}
return false;
}
function Go_To_Page(page) {
window.location = page;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是否有任何原因导致您无法使用自定义操作功能?例如,使用类似于以下内容的功能元素代码,但修改 CustomAction 的序列号元素 来定位菜单选项:
设置内容类型应确保该功能不适用于文件夹。如果由于某种原因它显示并且似乎无法禁用它,您可以使用 JavaScript/jQuery 从文件夹中隐藏菜单选项。
Is there any reason why you aren't able to use a custom action feature? For example use feature element code similar to the following but amend the Sequence number of the CustomAction element to locate the menu option:
Setting the content type should ensure the feature doesn't apply to folders. If for some reason it is showing and there appears to be no way to disable it, you could use JavaScript/jQuery to hide the menu option from folders.
在包含用户控件的功能的元素 XML 中,在其中添加序列:
In the elements XML for your feature where you include the User Control, add the sequence there: