0

我很難調試這個。我在SharePoint 2010中有一個標準WebPart,並在其上定製功能區。在FireFox,Safari和Chrome中一切正常。但是當涉及到IE時,我得到以下錯誤。SharePoint:Custom Ribbon + IE = cui.debug.js錯誤(無效的參數。)

網頁錯誤的詳細信息

用戶代理:Mozilla的/ 4.0(兼容; MSIE 8.0; Windows NT的6.1; WOW64; 三叉戟/ 4.0; SLCC2; .NET CLR 2.0.50727 ; .NET CLR 3.5.30729; .NET CLR 3.0.30729; InfoPath.3; .NET4.0C; .NET4.0E)時間戳:星期四,2011年6月23日 五時29分39秒UTC

消息:無效的參數。行:11611 字符:17代碼:0 URI: http://example.com/_layouts/cui.debug.js?rev=seEKIhJXfBClfYcr46fd3w%3D%3D

我附上的代碼片段,我覺得可能對您有所幫助。對於上下文選項卡


定義:

<ContextualGroup Id="Ribbon.MyWPContextualTabGroup" 
       Color="Blue" 
       Title="{title}" 
       Command="MyWPContextualTab.EnableContextualGroup" 
       Sequence="502" 
       ContextualGroupId="MyWPContextualTabGroup"> 
    <Tab Id="Ribbon.MyWPTab" 
     Title="My Work" 
     Description="My Work tab description" 
     Command="MyWPContextualTab.EnableMyWPTab" 
     Sequence="501"> 
    <Scaling Id="Ribbon.MyWPTab.Scaling"> 
     <MaxSize Id="Ribbon.MyWPTab.MaxSizeNew" 
       GroupId="Ribbon.MyWPTab.MyWPGroupNew" 
       Size="MyWPLayout" /> 
     <MaxSize Id="Ribbon.MyWPTab.MaxSizeManage" 
       GroupId="Ribbon.MyWPTab.MyWPGroupManage" 
       Size="MyWPLayout" /> 
     <MaxSize Id="Ribbon.MyWPTab.MaxSizeViews" 
       GroupId="Ribbon.MyWPTab.MyWPGroupViews" 
       Size="MyWPLayout" /> 
     <MaxSize Id="Ribbon.MyWPTab.MaxSizeShareTrack" 
       GroupId="Ribbon.MyWPTab.MyWPGroupShareTrack" 
       Size="MyWPLayout" /> 
     <MaxSize Id="Ribbon.MyWPTab.MaxSizeWorkflows" 
       GroupId="Ribbon.MyWPTab.MyWPGroupWorkflows" 
       Size="MyWPLayout" /> 
     <Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingNew" 
      GroupId="Ribbon.MyWPTab.MyWPGroupNew" 
      Size="MyWPLayout" /> 
     <Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingManage" 
      GroupId="Ribbon.MyWPTab.MyWPGroupManage" 
      Size="MyWPLayout" /> 
     <Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingViews" 
      GroupId="Ribbon.MyWPTab.MyWPGroupViews" 
      Size="MyWPLayout" /> 
     <Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingShareTrack" 
      GroupId="Ribbon.MyWPTab.MyWPGroupShareTrack" 
      Size="MyWPLayout" /> 
     <Scale Id="Ribbon.MyWPTab.Scaling.MyWPTabScalingWorkflows" 
      GroupId="Ribbon.MyWPTab.MyWPGroupWorkflows" 
      Size="MyWPLayout" /> 
    </Scaling> 
    <Groups Id="Ribbon.MyWPTab.Groups"> 
     <Group Id="Ribbon.MyWPTab.MyWPGroupNew" 
      Description="New group description" 
      Title="New" 
      Command="MyWPContextualTab.EnableMyWPGroupNew" 
      Sequence="52" 
      Template="Ribbon.Templates.MyWPTemplate"> 
     <Controls Id="Ribbon.MyWP.New.Controls"> 
      <Button Id="Ribbon.MyWP.New.NewItem" 
        Command="MyWP.Cmd.NewItem" 
        Description="Add a new item" 
        LabelText="New Item" 
        TemplateAlias="ONERW" 
        Image32by32="_layouts/images/MyWP/ribbon/newitem-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/newitem-16.png" /> 
     </Controls> 
     </Group> 
     <Group Id="Ribbon.MyWPTab.MyWPGroupManage" 
      Description="Manage group description" 
      Title="Manage" 
      Command="MyWPContextualTab.EnableMyWPGroupManage" 
      Sequence="53" 
      Template="Ribbon.Templates.MyWPTemplate"> 
     <Controls Id="Ribbon.MyWP.Manage.Controls"> 
      <Button Id="Ribbon.MyWP.Manage.ViewItem" 
        Command="MyWP.Cmd.ViewItem" 
        Description="View this item" 
        LabelText="View Item" 
        TemplateAlias="ONERW" 
        Sequence="5" 
        Image32by32="_layouts/images/MyWP/ribbon/viewitem-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/viewitem-16.png" /> 
      <Button Id="Ribbon.MyWP.Manage.EditItem" 
        Command="MyWP.Cmd.EditItem" 
        Description="Edit this item" 
        LabelText="Edit Item" 
        TemplateAlias="ONERW" 
        Sequence="10" 
        Image32by32="_layouts/images/MyWP/ribbon/edititem-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/edititem-16.png" /> 
      <Button Id="Ribbon.MyWP.Manage.VersionHistory" 
        Command="MyWP.Cmd.VersionHistory" 
        Description="Version History" 
        LabelText="Version History" 
        TemplateAlias="THRRW" 
        Sequence="15" 
        Image32by32="_layouts/images/MyWP/ribbon/versionhistory-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/versionhistory-16.png" /> 
      <Button Id="Ribbon.MyWP.Manage.ItemPermissions" 
        Command="MyWP.Cmd.ItemPermissions" 
        Description="Item Permissions" 
        LabelText="Item Permissions" 
        TemplateAlias="THRRW" 
        Sequence="20" 
        Image32by32="_layouts/images/MyWP/ribbon/itempermissions-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/itempermissions-16.png" /> 
      <Button Id="Ribbon.MyWP.Manage.DeleteItem" 
        Command="MyWP.Cmd.DeleteItem" 
        Description="Delete Item" 
        LabelText="Delete Item" 
        TemplateAlias="THRRW" 
        Sequence="25" 
        Image32by32="_layouts/images/MyWP/ribbon/deleteitem-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/deleteitem-16.png" /> 
      <Button Id="Ribbon.MyWP.Manage.Comments" 
        Command="MyWP.Cmd.Comments" 
        Description="Comments" 
        LabelText="Comments" 
        TemplateAlias="ONERW" 
        Sequence="30" 
        Image32by32="_layouts/images/MyWP/ribbon/comments-32.ico" 
        Image16by16="_layouts/images/MyWP/ribbon/comments-16.png" /> 
     </Controls> 
     </Group> 
     <Group Id="Ribbon.MyWPTab.MyWPGroupViews" 
      Description="Views group description" 
      Title="Views" 
      Command="MyWPContextualTab.EnableMyWPGroupViews" 
      Sequence="54" 
      Template="Ribbon.Templates.MyWPTemplate"> 
     <Controls Id="Ribbon.MyWP.Views.Controls"> 
      <Button Id="Ribbon.MyWP.Views.SaveView" 
        Command="MyWP.Cmd.SaveView" 
        Description="Save View" 
        LabelText="Save View" 
        TemplateAlias="THRRW" 
        Image32by32="_layouts/images/MyWP/ribbon/saveview-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/saveview-16.png" /> 
      <Button Id="Ribbon.MyWP.Views.RenameView" 
        Command="MyWP.Cmd.RenameView" 
        Description="Rename View" 
        LabelText="Rename View" 
        TemplateAlias="THRRW" 
        Image32by32="_layouts/images/MyWP/ribbon/renameview-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/renameview-16.png" /> 
      <Button Id="Ribbon.MyWP.Views.DeleteView" 
        Command="MyWP.Cmd.DeleteView" 
        Description="Delete View" 
        LabelText="Delete View" 
        TemplateAlias="THRRW" 
        Image32by32="_layouts/images/MyWP/ribbon/deleteview-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/deleteview-16.png" /> 
      <Label Id="Ribbon.MyWP.Views.CurrentViewLabel" 
       LabelText="Current View:" 
       ForId="Ribbon.MyWP.Views.CurrentViewDropDown" 
       TemplateAlias="THRRW" /> 
      <DropDown Id="Ribbon.MyWP.Views.CurrentViewDropDown" 
        Command="MyWP.Cmd.CurrentViewDropDown" 
        PopulateDynamically="true" 
        PopulateQueryCommand="MyWP.Cmd.CurrentViewDropDown.Populate" 
        TemplateAlias="THRRW" /> 
      <Button Id="Ribbon.MyWP.Views.SelectColoumns" 
        Command="MyWP.Cmd.SelectColoumns" 
        Description="Select Coloumns" 
        LabelText="Select Coloumns" 
        TemplateAlias="THRRW" 
        Image32by32="_layouts/images/MyWP/ribbon/selectcoloumns-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/selectcoloumns-16.png" /> 
      <Button Id="Ribbon.MyWP.Views.ShowHideFilters" 
        Command="MyWP.Cmd.ShowHideFilters" 
        Description="Show/Hide Filters" 
        LabelText="Show/Hide Filters" 
        TemplateAlias="THRRW" 
        Image32by32="_layouts/images/MyWP/ribbon/showhidefilters-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/showhidefilters-16.png" /> 
      <Button Id="Ribbon.MyWP.Views.ViewCompletedItems" 
        Command="MyWP.Cmd.ViewCompletedItems" 
        Description="View Completed Items" 
        LabelText="View Completed Items" 
        TemplateAlias="THRRW" 
        Image32by32="_layouts/images/MyWP/ribbon/viewcompleteditems-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/viewcompleteditems-16.png" /> 
      <Button Id="Ribbon.MyWP.Views.ClearCompletedItems" 
        Command="MyWP.Cmd.ClearCompletedItems" 
        Description="Clear Completed Items" 
        LabelText="Clear Completed Items" 
        TemplateAlias="THRRW" 
        Image32by32="_layouts/images/MyWP/ribbon/clearcompleteditems-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/clearcompleteditems-16.png" /> 
     </Controls> 
     </Group> 
     <Group Id="Ribbon.MyWPTab.MyWPGroupShareTrack" 
      Description="Group description" 
      Title="Share &amp; Track" 
      Command="MyWPContextualTab.EnableMyWPGroupShareTrack" 
      Sequence="55" 
      Template="Ribbon.Templates.MyWPTemplate"> 
     <Controls Id="Ribbon.MyWP.ShareTrack.Controls"> 
      <Button Id="Ribbon.MyWP.ShareTrack.AlertMe" 
        Command="MyWP.Cmd.AlertMe" 
        Description="Alert Me" 
        LabelText="Alert Me" 
        TemplateAlias="ONERW" 
        Image32by32="_layouts/images/MyWP/ribbon/alertme-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/alertme-16.png" /> 
     </Controls> 
     </Group> 
     <Group Id="Ribbon.MyWPTab.MyWPGroupWorkflows" 
      Description="Group description" 
      Title="Workflows" 
      Command="MyWPContextualTab.EnableMyWPGroupWorkflows" 
      Sequence="56" 
      Template="Ribbon.Templates.MyWPTemplate"> 
     <Controls Id="Ribbon.MyWP.Workflows.Controls"> 
      <Button Id="Ribbon.MyWP.Workflows.Workflows" 
        Command="MyWP.Cmd.Workflows" 
        Description="Workflows" 
        LabelText="Workflows" 
        TemplateAlias="ONERW" 
        Image32by32="_layouts/images/MyWP/ribbon/workflows-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/workflows-16.png" /> 
      <Button Id="Ribbon.MyWP.Workflows.ApproveReject" 
        Command="MyWP.Cmd.ApproveReject" 
        Description="Approve Reject" 
        LabelText="Approve Reject" 
        TemplateAlias="ONERW" 
        Image32by32="_layouts/images/MyWP/ribbon/approvereject-32.png" 
        Image16by16="_layouts/images/MyWP/ribbon/approvereject-16.png" /> 
     </Controls> 
     </Group> 
    </Groups> 
    </Tab> 
</ContextualGroup> 


的上下文選項卡定義:

<GroupTemplate Id="Ribbon.Templates.MyWPTemplate"> 
    <Layout Title="MyWPLayout" 
      LayoutTitle="MyWPLayout"> 
    <OverflowSection Type="OneRow" 
        DisplayMode="Large" 
        TemplateAlias="ONERW" /> 
    <OverflowSection Type="ThreeRow" 
        DisplayMode="Medium" 
        TemplateAlias="THRRW" /> 
    </Layout> 
</GroupTemplate> 


MyWPContextualTabWebComponent.js:

Type.registerNamespace('ContextualTabWebPart'); 

var _webPartPageComponentId; 

ContextualTabWebPart.CustomPageComponent = function ContextualTabWebPart_CustomPageComponent(webPartPcId, gridId) 
{ 
    this._webPartPageComponentId = webPartPcId; 
    this.$gridId = gridId; 

    ContextualTabWebPart.CustomPageComponent.initializeBase(this); 
} 

ContextualTabWebPart.CustomPageComponent.prototype = { 

    $gridId: null, 

    init: function ContextualTabWebPart_CustomPageComponent$init() { }, 

    getFocusedCommands: function ContextualTabWebPart_CustomPageComponent$getFocusedCommands() 
    { 
     return [ 
     'MyWPContextualTab.EnableMyWPTab', 
     'MyWPContextualTab.EnableMyWPGroupNew', 
     'MyWP.Cmd.NewItem', 
     'MyWPContextualTab.EnableMyWPGroupManage', 
     'MyWP.Cmd.ViewItem', 
     'MyWP.Cmd.EditItem', 
     'MyWP.Cmd.VersionHistory', 
     'MyWP.Cmd.ItemPermissions', 
     'MyWP.Cmd.DeleteItem', 
     'MyWP.Cmd.Comments', 
     'MyWPContextualTab.EnableMyWPGroupViews', 
     'MyWP.Cmd.SaveView', 
     'MyWP.Cmd.RenameView', 
     'MyWP.Cmd.DeleteView', 
     'MyWP.Cmd.CurrentViewDropDown', 
     'MyWP.Cmd.CurrentViewDropDown.Populate', 
     'MyWP.Cmd.SelectColoumns', 
     'MyWP.Cmd.ShowHideFilters', 
     'MyWP.Cmd.ViewCompletedItems', 
     'MyWP.Cmd.ClearCompletedItems', 
     'MyWPContextualTab.EnableMyWPGroupShareTrack', 
     'MyWP.Cmd.AlertMe', 
     'MyWPContextualTab.EnableMyWPGroupWorkflows', 
     'MyWP.Cmd.Workflows', 
     'MyWP.Cmd.ApproveReject']; 
    }, 

    getGlobalCommands: function ContextualTabWebPart_CustomPageComponent$getGlobalCommands() 
    { 
     return []; 
    }, 

    isFocusable: function ContextualTabWebPart_CustomPageComponent$isFocusable() 
    { 
     return true; 
    }, 

    canHandleCommand: function ContextualTabWebPart_CustomPageComponent$canHandleCommand(commandId) 
    { 
     //Contextual Tab commands 

     var commands = [ 
     'MyWPContextualTab.EnableMyWPTab', 
     'MyWPContextualTab.EnableMyWPGroupNew', 
     'MyWP.Cmd.NewItem', 
     'MyWPContextualTab.EnableMyWPGroupManage', 
     'MyWP.Cmd.ViewItem', 
     'MyWP.Cmd.EditItem', 
     'MyWP.Cmd.VersionHistory', 
     'MyWP.Cmd.ItemPermissions', 
     'MyWP.Cmd.DeleteItem', 
     'MyWP.Cmd.Comments', 
     'MyWPContextualTab.EnableMyWPGroupViews', 
     'MyWP.Cmd.SaveView', 
     'MyWP.Cmd.RenameView', 
     'MyWP.Cmd.DeleteView', 
     'MyWP.Cmd.CurrentViewDropDown', 
     'MyWP.Cmd.CurrentViewDropDown.Populate', 
     'MyWP.Cmd.SelectColoumns', 
     'MyWP.Cmd.ShowHideFilters', 
     'MyWP.Cmd.ViewCompletedItems', 
     'MyWP.Cmd.ClearCompletedItems', 
     'MyWPContextualTab.EnableMyWPGroupShareTrack', 
     'MyWP.Cmd.AlertMe', 
     'MyWPContextualTab.EnableMyWPGroupWorkflows', 
     'MyWP.Cmd.Workflows', 
     'MyWP.Cmd.ApproveReject']; 

     for (var i = 0; i < commands.length; i++) 
     { 
      if (commandId === commands[i]) return true; 
     } 
    }, 

    handleCommand: function ContextualTabWebPart_CustomPageComponent$handleCommand(commandId, properties, sequence) 
    { 
     if (commandId === 'MyWP.Cmd.NewItem') doActionOnItem(this.$gridId, 'new'); 

     if (commandId === 'MyWP.Cmd.ViewItem') doActionOnItem(this.$gridId, 'view'); 

     if (commandId === 'MyWP.Cmd.EditItem') doActionOnItem(this.$gridId, 'edit'); 

     if (commandId === 'MyWP.Cmd.VersionHistory') doActionOnItem(this.$gridId, 'version'); 

     if (commandId === 'MyWP.Cmd.ItemPermissions') doActionOnItem(this.$gridId, 'perms'); 

     if (commandId === 'MyWP.Cmd.DeleteItem') doActionOnItem(this.$gridId, 'delete'); 

     if (commandId === 'MyWP.Cmd.Comments') doActionOnItem(this.$gridId, 'comments'); 

     if (commandId === 'MyWP.Cmd.AlertMe') doActionOnItem(this.$gridId, 'subscribe'); 

     if (commandId === 'MyWP.Cmd.Workflows') doActionOnItem(this.$gridId, 'workflows'); 

     if (commandId === 'MyWP.Cmd.ApproveReject') doActionOnItem(this.$gridId, 'approve'); 

     if (commandId === 'MyWP.Cmd.ClearCompletedItems') doActionOnItem(this.$gridId, 'clear-completed'); 
    }, 

    getId: function ContextualTabWebPart_CustomPageComponent$getId() 
    { 
     return this._webPartPageComponentId; 
    } 
} 

ContextualTabWebPart.CustomPageComponent.registerClass('ContextualTabWebPart.CustomPageComponent', CUI.Page.PageComponent); 
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs("MyWPContextualTabPageComponent.js"); 
+0

我已經從imageshack.com域上的這個問題中刪除了一些圖片,因爲它們不再可用。我不確定問題中是否有足夠的信息保持開放? – halfer

回答

0

每當你調用JS功能,在此線:

SP.SOD.executeOrDelayUntilScriptLoaded([YOUR JS FUNCTION HERE], ""sp.ribbon.js""); 

這將等待色帶JS加載,然後執行你的js函數。看看這是否有幫助!