How to fetch the rows and column values for the Tree component in CAF

Hello Experts,

Needed to know how we could fetch the rows and the various column values contained in the Tree to manipulate the values of certain fields using JavaScript ? I tried doing this but did not achieve

var table = CAF.model(“#{activePageBean.clientIds[‘asyncTable’]}”);
for(var i=0;i<table.getRowCount();i++){
row = table.get(i);
var row = table.get(“row-one”);
var dropdownId = row.getControlId(“htmlOutputText2”);
var dropdown = CAF.model(dropdownId);
}

This line is retreiveing me null value— var dropdown = CAF.model(dropdownId);

Currently I am working on a requirement to display Date Time according to User’s Time zone . I have made use of JavaScript to retrieve user’s Time zone . Now this i needed to pass to converter for a certain field present in the Tree to show Date Time according to user’s Time Zone. Unfortunately I am not able to achieve without refreshing the panel containing the Tree ( i.e. i want this converted time to be displayed when user lands in this page containing the Tree for the first time itself without refreshing the part of the page) .

If anyone had worked on this before or have better ideas to implement the solution for this requirement , kindly do share .

Thank you.

Regards,
Nischal

Seems like your table rowID is not coming properly.
what output you are getting for
row = table.get(i);
&
var row = table.get(“row-one”);

In the mean time if you are trying to implement the logic onclick of some row then below code logic should work…


CAF.model('#{activePageBean.clientIds["tree"]}').addRowChangeListener(
  function(id, rowId, type) {
  var rowModel =CAF.model(rowId); 
var delControlFlagId=rowModel.getControlId("deleteControlFlag");
var delControlFlagModel=CAF.model(delControlFlagId);
var delControlFlag=delControlFlagModel.getValue();
}
});

Thanks

Check the configuration of your output text control with the id = “htmlOutputText2”. If it is configured with the “Raw” property set to true then it won’t render a tag the “id” attribute around the text.

If you need to reference the output text element by its ID from a client-side script, then you would have to set the “Raw” property to false so the text element can be identified by its client-side d.