Products | Versions |
---|---|
ibi WebFOCUS | 8207.28.06 |
In multiple double list boxes on a html form want to automatically select certain columns on load and put them in the box on the right using a button click.
You can observe in the below screenshot that from the left list box multiple columns need to be transferred to the right using a button click:
We can get similar effect using the App Studio JavaScript function, IbComposer_setCurrentSelection and using jQuery.
Use App Studio HTML canvas and follow the below steps:
1. Created a new HTML and added a Double List control using the sample master file, GGSALES.mas as the field, SEQ_NO provides a lot of values.
2. Select each of the list boxes to find their IDs. In this case the left control is "customselect1_selectfrom" and the right pane is "customselect1_selectto".
3. Navigate to the 'Embedded JavaScript' tab.
4. Added the following under the window_onload function.
var arr = [];
arr.push('23');
arr.push('1111');
arr.push('3434');
arr.push('4000');
IbComposer_setCurrentSelection('customselect1_selectfrom',arr,'true');
This will highlight the values we pushed into the array.
5. I then added the following jQuery function to clone the selected values and clone them to the right pane
$('#customselect1_selectto').append($('#customselect1_selectfrom').find('option:selected').clone());
Refer the below screenshots for reference:
1) Refer the below link to get a better understanding on Function: IbComposer_setCurrentSelection, page 524.
https://docs.tibco.com/pub/wf-as/9.2.3/doc/pdf/IBI_wf-as_9.2.3_users_guide.pdf?id=1
2) How to add multiple values from a select listbox to another listbox on click of a button using javascript function?