Using a Task Webpart with custom column - want to add graphical indicators RRS feed

  • Question

  • I have created a PC column and a PC Icon Column.  I want a image to display in the PC Icon Column.  I have edited the PC Icon column and selected Calculation based on another column (PC) and added the following to the formula field.

    =IF(PC="","",IF(PC="No Problems","<DIV><border='0′img src='IMAGE LOCATION/green.gif'></DIV>",IF(PC="Minor Problems","<DIV><border='0′ img src=IMAGE LOCATION/yellow.gif'></DIV>",IF(PC="Major Problems","<DIV><border='0′ img src=IMAGE LOCATION/Red.gif'></DIV>","end"))))

    I added a content editor webpart and edited the source editor:

    <script type=”text/javascript”>
    var iconLibraryPath = “/path/to/pictures/”;
    var allCells = document.getElementsByTagName(“td”);
    for(i=0;i<allCells.length; i++){
    var iconCell = allCells[i].innerText.split(“XXX”);
    if(iconCell[0] == “indicatorIcon”){
    allCells[i].innerHTML = “<DIV><IMG src=\”" + iconLibraryPath + iconCell[1] + “.gif\” /></DIV>”;
    }catch(e){ }

    This web view displays the correct string (green, yellow or red) in the PC Icon column based on the PC field, but does not display the image.  Example:  This is the text displaying in the column instead of the green icon image:

    <DIV><border='0′img src='IMAGE LOCATION/green.gif'></DIV>


    Any assistance would be appreciated.

    Sunday, April 3, 2011 3:58 AM


  • Do you have this 100% correct?

    <DIV><border='0′img src='IMAGE LOCATION/green.gif'></DIV>

    What your saying is that your seeing a <border='0' before the IMG

    Is it possible that your have other unclosed tags causing this problem. have you tried putting an alert(iconLibraryPath + iconCell[1]) and see what your getting back there ( just to verify thats correct )


    -tom daly
    Thursday, May 5, 2011 2:34 AM