Pergunta

I am trying to create a web part in SharePoint to get data from a custom list that contains our departments revenues. I don't want the users to check the original values instead I have a publishing page with Script Editor containing my code. The problem is HighCharts require specific jQuery 1.8.2 to be installed but in our site we have an older version of jQuery which I can't change due to usage in other areas. Anyone faced such an issue with this functionality?

Foi útil?

Solução

Actually we developed something that handles both the jQuery references and both charts requirements (although not hightcharts). You can check it out in this video.

So you can use something like this to style your list views without even coding, I am not sure if the look and feel of charts there match what you need, but that would give you a fast solution without coding for your issue.

You can download it from the store here.

Outras dicas

You can dynamically remove the old jQuery using below JavaScript

var targetelement="script";
var targetattr="src";
var oldJqueryFileName = "jquery.min.js";
var allsuspects=document.getElementsByTagName(targetelement);
for (var i=allsuspects.length; i>=0; i--){ 
    if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(oldJqueryFileName)!=-1)
        allsuspects[i].parentNode.removeChild(allsuspects[i]);
}

Then you can add your new jQuery file using

var newjQueryFileName = "jQuery1.8.2.js";

var fileref=document.createElement('script');
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", newjQueryFileName)

document.getElementsByTagName("head")[0].appendChild(fileref)

This way it ensure the old jQuery is removed from only the page in question.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top