Click here to Skip to main content
15,887,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I retrieved list columns data using "Include" method and in success method retrieved each item field values and saving in an array, but i am unable to get url of the "Image" column.please repond ASAP.

What I have tried:

below is the code:

function loadStructure() {
// alert("");
//Querying SP using SCOM
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle("Employee"); //Employee is SP List containing heirarchy data of the Orgnization
var viewXml = '<view><rowlimit>1200';
var query = new SP.CamlQuery();
query.set_viewXml(viewXml);
this.items = list.getItems(query);
context.load(items, 'Include(Title, Manager,Designation,Image)');
context.add_requestSucceeded(onLoaded);
context.add_requestFailed(onFailure);
context.executeQueryAsync();

function onLoaded() {
//Adding SCOM return objects to an array
var tasksEntries = [];
var itemsCount = items.get_count();
for (i = 0; i < itemsCount; i++) {
var item = items.itemAt(i);
var taskEntry = item.get_fieldValues();
tasksEntries.push(taskEntry);
}
//array's filter function wont work in IE8. Hence GetChildArrayObjects
//var topHead = tasksEntries.filter(function (item) { return (item.Manager == null) });
var topHead = GetChildArrayObjects(tasksEntries, null);

/////Logic to create
  • ....
for jQuery orgChart -- ####Starts Here
var headName = topHead[0].Title;

var title = topHead[0].Designation + ", Manager :" + topHead[0].Manager;

var listString = "
  • " + headName;

    //Calling the recursive function.getChildNodes
    var childliststring = getChildNodes(tasksEntries, headName, listString);

    listString = childliststring + "
";

var divForList = document.getElementById('left');
divForList.innerHTML = listString;
/////Logic to create
  • ....
for jQuery orgChart -- ####Ends Here

//Populating OrgChart using Jquery OrgChart Plug in - Basically it reads Created
  • list named 'organisation' and writes a TABLE - DIV structure.
    $("#organisation").orgChart({ container: $("#main"), nodeClicked: onChartNodeClicked });

    //enabling balloon for each orgchart block
    for (var i = 0; i < tasksEntries.length; i++) {
    //alert(tasksEntries[i].Image);
    alert(tasksEntries[i].Image.get_url);
    $("div[title=\"" + tasksEntries[i].Title + "\"]").balloon({
    contents: '
    • Designation :' + tasksEntries[i].Designation + '
    • Phone# : 123-234-1233
    '

    });

    }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900