Dynamically displaying header field in treegrid

Hi,

I have a treegrid with list of groups and users coming from a XML data. I need to get the count of the total number of groups and users and display it in the treegrid header field as a summary. Eg: “Name 30 users in 3 groups”

I am able to get the value of users and groups, but not able to display it in treegrid header. When I try to display it I get the first value stored.

To be more specific

I have created function to display the users and groups, from which I am sucessfully getting the length of users and groups. I created global variables for both user, as below.

var groupLength = null;
var userLength = null;
groupLength = row.length;
 alert ("total number of groups " + groupLength); //just to make sure am getting the value 
userLength = group.length;
 alert ("total number of users" + userLength ); //just to make sure am getting the value

But when I call those variables in the treegrid field value as below, its displaying the value “Null”. If I change the value of global variable to some other digit like 0 or 3 , its displaying that digit.

Here is my code for treegrid

isc.TreeGrid.create({
  ID: "documentAccessReportTreeGrid",
  autoFetchData: false, 
  dataSource: "documentAccessReportDS",  
  headerBaseStyle:"treeGridHeadStyle",    	
  openerImage: null,
  nodeIcon: "/images/person_16.png",  
  folderIcon: "/images/person_gp_16.png",
  openIconSuffix: "",
  closedIconSuffix: "",
  alternateRecordStyles: true,   
  leaveScrollbarGap: false,
  height: "100%", 
  fields: [
    { title: "Name" + "<br>" + userLength  + "users in " + groupLength  + " groups" + "</br>", name: "name", treeField: true, width: 175},    
    { title: "Organization", name: "organization", width:170},
    { title: "Role", name: "role", align:"center"},
    { title: "Access", name: "access", align:"center" },
    { title: "Downloaded", name: "downloaded", align:"center" },
    { title: "Printed", name: "printed", align:"center" },
    { title: "Viewed", name: "viewed", align:"center" },    
    { title: "Last Viewed", name: "lastViewed",align:"center", width:150 },        
    { title: "Version", name: "version", align:"center" }
  ]  
});

I understood that its not able to refresh and render the header fields. How is it possible to refresh this. Can you please provide me with a solution for this.

Hi Pshyama,

You can use setFieldProperties() to set the title of a field on the field, for example:

documentAccessReportTreeGrid.setFieldProperties(0, {
    title:"new title"
})

Not sure how you end up with “null”, but I would check on the actual value of the String that is passed to the title attribute, rather than just the values of some of the numbers used to form it.