Focal Point
Tree Control in HTML Composer

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6477048326

September 05, 2012, 03:57 PM
MattC
Tree Control in HTML Composer
Hello everyone,

I have created a hierarchy tree control using the MULTI OR paramater creating check boxes instead of radio buttons.

The question I have is that when the page first loads it defaults the top Parent as being checked when I do not want it to be. I was wondering if I can control this via Javascript.

I tried using

 document.getElementById("treecontrol1").parentNode.checked=false; 


in the Window Onload, but it is not making a difference. I am not certain what type of element a tree control is and how to reference it.

Any help would me much appreciated.

Thanks


WebFOCUS 8.1.05
September 05, 2012, 04:09 PM
Francis Mariani
You must heed the following advice that's embedded in the HTML Composer generated code:

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports


Create a new JS function called onInitialUpdate and put your js line in it. (This still may not work, but at least you'll be calling the js the way you're supposed to).


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 05, 2012, 04:25 PM
MattC
Thanks Francis for the suggestion. That didn't work as well.

I can still check the value of what is selected and deal with it that way in the report itself, but I wanted to uncheck it to make it cleaner.


WebFOCUS 8.1.05
September 05, 2012, 05:19 PM
Francis Mariani
I don't know how you created check boxes instead of radio buttons - I can't seem to. Doe the tree control have "Default Selection" in the Properties window? It's Yes by default, perhaps setting it to No will not have any pre-selected check boxes.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 06, 2012, 07:11 AM
MattC
Yes it's not very intuitive. To create check boxes instead of radio, you need to select the parameters tab at the bottom of Composer. In the main window, right click and add a new parm and then drag your control to the new parm to link it. In the parm properties, you can select the Multi Or option and that will create your check boxes.

I have tried changing the default selection to No, but that does not make a difference.


WebFOCUS 8.1.05
September 06, 2012, 07:19 AM
David Glick
MattC,

You can specify a "selected value" in the Properties and Settings dialog for the tree control to have a different value selected by default. No JavaScript needed.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
September 06, 2012, 07:33 AM
MattC
Hi David,

If I do that, it does select the value that I entered as well as keeps the original checked. It also expands out the tree when I do that.

What do I put if I do not want any value selected?


WebFOCUS 8.1.05
September 06, 2012, 07:44 AM
MattC
I don't know if this makes a differences but my Tree is driven by an External Procedure and from what I gather it's pretty touchy.


WebFOCUS 8.1.05
September 06, 2012, 10:49 AM
Francis Mariani
"You can specify a "selected value" in the Properties and Settings dialog for the tree control to have a different value selected by default. No JavaScript needed." - I don't think this answered the question, but maybe it points to a possible solution: for the "selected value" enter a value that will never be populated by the external procedure, e.g. "xyzxyzxyz"...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 07, 2012, 07:24 AM
David Glick
MattC,

Set the "Default Selection" property in the Property Sheet to "No".


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
September 07, 2012, 12:14 PM
MattC
Yes I tried that, but it is not working correctly. I am having some strange behavoir with the Tree Controls. They functionally work, but if I add new parameters to my report/html, the Composer changes my parameters for the tree control back to single select intstead of multi.

It's quite painful as I am adding new filters in phases and having to go back in and set it all back up again for these Tree controls.


WebFOCUS 8.1.05
September 10, 2012, 07:19 AM
David Glick
You need to make sure your parameters are multiselect in the procedure that use them.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com
September 10, 2012, 07:27 AM
MattC
The parameters for the Tree Control are used in SQL. It's building an in list that is used in the SQL.

&BaseP is what is coming in from the Tree Control

-SET &BaseProdLength    = &BaseP.LENGTH;
-SET &BaseProdAdj       = STRREP (&BaseP.LENGTH, &BaseP, 3, ' OR ', 1, ',', &BaseP.LENGTH, 'A&BaseProdLength.EVAL');
-SET &BaseProdTru       = TRUNCATE(&BaseProdAdj);
-SET &BaseProdSQL       = IF '&BaseP.EVAL' CONTAINS 'OR' THEN ',in_base_prod_group_tbl => mktgdw.t_number_tbl(&BaseProdTru.EVAL)' ELSE ',in_base_prod_group_tbl => mktgdw.t_number_tbl(&BaseP.EVAL)';
  


How do I make that a multiselect parameter in the procedure?

Thanks


WebFOCUS 8.1.05
September 11, 2012, 07:20 AM
David Glick
Unfortunately, in that construct you cannot. If it was in a WHERE, you use OR or AND in the parameter syntax. Composer requires this to know it is multiselect since there is no property on the Property Sheet for the tree control until WebFOCUS Release 8. So you will need to do it your way until you move to release 8.


David Glick
Director WebFOCUS App Studio
and WebFOCUS Developer Studio
WebFOCUS Division
Information Builders, Inc.
Direct (917) 339-5560
Voice Mail (212) 736-6250 x3560
Fax (212) 947-5168
Email david_glick@ibi.com