Focal Point
HTML Composer: IbComposer_setCurrentSelection with a multi-select Tree Control

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

March 13, 2013, 10:28 AM
Francis Mariani
HTML Composer: IbComposer_setCurrentSelection with a multi-select Tree Control
I am attempting to use IbComposer_setCurrentSelection to reset a multi-select Tree Control to a particular set of values. I call the function like this:

// Reset the Tree Control
parent.parent.IbComposer_setCurrentSelection('P_NODE_NO', 'x');
// Populate the Tree Control
P_NODE_NO = '1, 3';
parent.parent.IbComposer_setCurrentSelection('P_NODE_NO', P_NODE_NO);

Only the first value (1) gets selected. If I have only one value, it gets selected. Multiple values do not get selected.

Also, is there a way to reset a multi-select tree control? I'm currently doing this by setting it to a non-existent value, but I would like to use the official method.

Thank you,


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
March 13, 2013, 10:37 AM
Francis Mariani
// Loop does not work - only last values is selected
for(var i = 0 ; i < P_NODE_NO.length ; ++i)
  {
  alert(P_NODE_NO[i])
  parent.parent.IbComposer_setCurrentSelection('P_NODE_NO', P_NODE_NO[i]);
  }

This does not work:
parent.parent.IbComposer_setCurrentSelection('P_NODE_NO', '1 OR 2');



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
March 13, 2013, 11:55 AM
MAdams1
Hi Francis, I just went through this a week or so ago with Barry S., however, I was using a listbox control. I got very frustrated trying to figure out why I could get the first selection or the last selection but not both. We discovered it was a bug with the RIA theme applied, which you probably aren't using(most people don't and I can see why). So in our example not using a RIA theme, this code worked;

 
 
function onInitialUpdate(){
var listbox = document.getElementById("listbox1");
 
        for(var count=0; count < listbox.options.length; count++) {            
            listbox.options(count).selected = true;    
} 
 
} 
 
//Begin function button1_onclick
function button1_onclick(ctrl) {
 
IbComposer_setCurrentSelection('listbox2', IbComposer_getCurrentSelection('listbox1'), false);
}

 

This will select all items in the first listbox on load then with button click will select the same items in the second listbox.

Hope it helps.

Michelle


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
March 13, 2013, 12:21 PM
Francis Mariani
Michelle,

Thanks for this. I think the problem is the multi-select Tree Control is an even more special beast than a double list (which I think is what you're working with) so I'm not sure your solution will work in my case.

After much investigation inside ibirls3.js, it appears the multi-select Tree Control is not recognized as multi select in the functions that IbComposer_setCurrentSelection calls.

Adding one line of code makes it work - Force the Tree Control to be recognized as multi-select :

// Added By Francis Mariani - 2013/03/13 to force Tree Controls to be recognized as multi-select
if (type == 28) multi = 'multiple';


Doing this is completely illegal but it improves my quality of life. I've done this in the Dev environment until I get a better solution from Tech Support.


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
March 13, 2013, 01:32 PM
Francis Mariani
Of course this won't work on the first try!

The Tree Control seems to be a very very special beast. Upon load of the page, collapsed tree branches are not known to the Document Object Model (DOM), hence they will not be selected by this method.


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
March 13, 2013, 02:48 PM
TexasStingray
Try removing the space after the comma.




Scott

No difference.

So, even without this reported problem, IbComposer_setCurrentSelection doesn't work properly with multi-select tree controls. If the value to be set is in a branch that has not yet been expanded, it does not get set.


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
I was informed by Tech Support that the API function IbComposer_setCurrentSelection does not support a multi-select tree control, even though it does support other multi-select controls and the single-select tree control.


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
Good to know...


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
I should have mentioned that it is supported in v8.


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