'ProjectTaskButtonAppName' non è definito quando si fa clic scheda Lista in nastro

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/15650

  •  16-10-2019
  •  | 
  •  

Domanda

Mi è toccato il seguente errore Javascript quando si fa clic sulla scheda Elenco il nastro SP2010 per una lista Progetto Penso che ho messo in un webpart nella pagina default.aspx:

Webpage dettagli di errore

User Agent: Mozilla / 4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident / 4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; PC Media Center 6.0; .NET4.0C; .NET4.0E; InfoPath.3) Timestamp: mar, 5 luglio 2011 20:32:33 UTC

Messaggio: 'projectTaskButtonAppName' non è definito Linea: 1302 Char: 9 Codice: 0 URI: http://sptest/_layouts/sp.ribbon.debug.js?rev=lc6eCMZP6gL5LnuSYh0S6Q%3D%3D

Ho cercato piuttosto spesso e non hanno trovato altre lamentele ..

Qualcuno ha qualche idea di quello che posso controllare? Non ho MS Project sulla mia macchina, ma sicuramente che non sarebbe rompere il JS.

È stato utile?

Soluzione 4

I solved the problem by adding a try catch to the JS that was breaking. I made the following change to SP.Ribbon.debug.js: Line 1302-

    try{    
    return !eval($v_0.HiddenScript);
    }
    catch(e){
    return true;
    }

Now the ribbon buttons are at least usable. I think I'll have to make this same change in SP.ribbon.js .

Perhaps this is due to me not having MS Project installed on my box.

Anyway hope this helps some other poor soul as well.

Altri suggerimenti

The Ribbon icons are grayed out but still Active/useable. If you click elsewhere, they tend to come back to life with color. Appears to be a SP Bug/scripting error that has a workaround.

I had the same problem with my project task list. In order to get rid of this problem i tested different web part settings for project task list. The option that worked for me was setting Toolbar type to: Full Toolbar.

I tried to hide 'New link' on List/Library View by set the List View WebPart's Toolbar property to "No Toolbar" and I got this Error. Then I found different approaches listed below.

Before that, please change the required Webpart's Toolbar Property back to "Summary Toolbar".

Approach 1 (Simple)

In common js file, which you used in the site (Or Create New JS file, upload it in Assets Library and give reference in your site Master Page) add the below code. This will simply create a empty div and add it to the page. It Works!

<script type="text/javascript" language="javascript">
    var elemDivTaskButton = document.createElement('div');
    document.body.appendChild(elemDivTaskButton);

    var projectTaskButtonAppName = (typeof projectTaskButtonAppName === 'undefined') ? elemDivTaskButton : projectTaskButtonAppName; 
</script>

Approach 2

  1. Create a HTML file with below code and upload it in SiteAssets Library.
  2. Edit the 'AllItems.aspx' page of the List (or required page where the list view added) and Add a Content Editor WebPart (CEWP).
  3. Edit the Content Editor WebPart and in "Content Link" property (On WebPart properties Panel) specify the above HTML file URL. Click 'Ok'.
  4. In 'Page' tab on Top Ribbon, click "Stop Editing". Now check the Page. The JS Error should be gone.

        //Invoke HideNewItemLinkAndActviateWP Method after PageLoad.
        _spBodyOnLoadFunctionNames.push("HideNewItemLinkAndActviateWP");
    
        function HideNewItemLink()
        {
            try
            {
                HideNewItemLink('Hero-WPQ2');
                SetWebPartActive('MSOZoneCell_WebPartWPQ2');
            }
            catch(err)
            {
                //Handle errors here
            }
        }
    
        function HideNewItemLink(tblId)
        {
            try
            {
                var tblNewItemLink = null;
                tblNewItemLink = document.getElementById(tblId);
                if(tblNewItemLink != null)
                {
                    tblNewItemLink.style.display='none';
                }
            }
            catch(err)
            {
                //Handle errors here
            }
        }
    
        function SetWebPartActive(wpId)
        {
            setTimeout(function() {
                var webPart = document.getElementById(wpId);
                if(webPart != null) {
                    var dummyEvent = new Array();
                    dummyEvent["target"] = webPart; 
                    dummyEvent["srcElement"] = webPart; 
                    WpClick(dummyEvent);
                    }
            }, 200)
        }
    

I've notice this issue occurs when you change the Toolbar.Type from "Standard" to "None" on the XsltListViewWebPart

Try adding a Content Editor webpart and add the code there as given in the first approach -

<script type="text/javascript" language="javascript">
    var elemDivTaskButton = document.createElement('div');
    document.body.appendChild(elemDivTaskButton);

    var projectTaskButtonAppName = (typeof projectTaskButtonAppName === 'undefined') ? elemDivTaskButton : projectTaskButtonAppName; 
</script>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top