Get Selected Items from ListBox
Hi,
How do I get the Selected items of a List in Flex.
I am using a multi-select List.
Thx
Never mind..I got it.
it as simple as that:
Alert.show (lst.selectedItem.fieldname);
;)
Similar Messages
-
How to get selected items from a tree in backing bean without adfbc
Hi ADF Experts,
Below is my code for af:tree. My question is how can I get selected Items from the selectionListener (without adf bc) this uses formation of tree from backing bean.
Using Jdev 11.1.1.7.0
<af:tree var="node" value="#{pageFlowScope.MerchandizeBean.model}"
binding="#{pageFlowScope.MerchandizeBean.treeModel}" id="tree" immediate="true" autoHeightRows="0"
styleClass="AFStretchWidth" rowSelection="multiple"
selectionListener="#{pageFlowScope.MerchandizeBean.treeNodeSelection}">
<f:facet name="nodeStamp">
<af:commandLink text="#{node.classDescription}"
actionListener="#{pageFlowScope.MerchandizeBean.createListManyItemForMerchandise}" id="displayTable" partialSubmit="true">
</af:commandLink>
</f:facet>
</af:tree>
public void treeNodeSelection(SelectionEvent selectionEvent) {
// Add event code here...
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected value
Thanks
RoyHi,
in a multi select case, try
RowKeySet rks = tree.getSelectedRowKeys();
Iterator iter = rks.iterator();
while(iterator.hasNext()){
Object aKey = iterator.next();
tree. setRowKey(aKey);
Object rowData ? tree.getRowData();
.... do something with the data here ...
Frank -
How to get the selected items from listbox
Regarding listbox i have two questions
1) I want to get the selected items as per the order in which ihave selected.Presently i'm getting in the ascending order.For example after selcting the 1,2,6 if i select 3 then its giving 1,2,3,6.But i want it in the order 1,2,6,3
2)I want to select items from a single list box to many other listboxes.(ie) my first selection should goto first,second one to the second listbox and like this.How should i write the logic.
please give me a suggestion.In order to have the selected items line up in accordance to the selection order, please do it one at a time. (That's the limit for that VI)
If you need more than that (i.e. to regconize which item clicked first and which one comes later), you may have to figure it out ya
Wish you good luck. Perhaps, someone else has a already made vi.
Cheers!
ian.f
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010
依恩与LabVIEW
LVVILIB.blogspot.com -
Getting selected item from combobox itemrenderer and storing in object
Hi Guys,
Can anyone help me in this regard. Its very urgent.
I have a combo box itemrenderer in datagrid column. I want to get the user selected item from the dropdown of the row(s) (User may select values from combo box from multiple rows of datagrid) and corressponding values of all other columns of the rows and store it in an object . Then pass this object to database to update only those rows that user has changed.
I am able to get the selected item from combo box using "event.currentTarget.selectedItem" and corressponding values of all other columns of the rows using "valueSelect.ID", etc where valueSelect is object which contains data for datagrid. But am stuck up with, how to store the selected item value of the combobox and corressponding values of all other columns of the rows into an Object ?.
Can anybody help me with sample to store selected item from combobox and its corressponding values of all other columns into an object which i can send to db...?
Kindly help me in this regard.
Thanks,
Anand.Hi!
Are you using a collection of VO or DTO as the dataprovider of the combobox component?
If so, have you created some attribute there to control the user's selection in the combobox?
For instance:
private var selected:Boolean = false;
If your solution fits this approach, you may create a new collection that contains just the objects that were selected by the user, it means you can loop through the datagrid's dataprovider and only insert in this new collection those objects that have the attribute "selected" set to true.
For instance:
private function getSelectedRecords(datagridDataProvider:ArrayCollection):ArrayCollection
var newCollection:ArrayCollection = new ArrayCollection();
for each (var item:Object in datagridDataProvider)
if (item.selected)
newCollection.addItem(item)
return newCollection;
Afterwards, you may serialize this new collection with your back-end.
Hope it helps you!
Cheers,
@Pablo_Souza -
Removing selected items from listbox
Hi ADF Experts,
I have a selectmanylistbox with few values displaying in UI and a Remove Button at the bottom.
User selects certain items from the listbox and clicks on Remove button. The selected items should be reomved. Can anybody suggest how to do this.
Thanks,
AnimeshDuplicate of https://forums.oracle.com/thread/2562542
User, please don't ask the same question multiple times. If you don't get the answer you want it may be because you did not give the right information and or use case me understand.
Timo -
Display selected item from Listbox
hi,
i get <h:selectOneListbox> value from database, now i want to know which item is selected in the listbox
my JSP code is
<h:selectOneListbox binding="#{DynamicListBean.std_list_lbx}" id="std_list_lbx" immediate="true"
onchange="common_timeoutSubmitForm(this.form, 'std_list_lbx');" required="true" size="5"
style="height: 312px; left: 168px; top: 192px; position: absolute; width: 216px" value="#{DynamicListBean.selectedCategory1}" valueChangeListener="#{DynamicListBean.std_list_lbx_processValueChange}">
<f:selectItems id="listbox1SelectItems1" value="#{DynamicListBean.items1}"/>
</h:selectOneListbox>Java code is public String getSelectedCategory1() {
return selectedCategory1;
public void setSelectedCategory1(String selectedCategory1) {
this.selectedCategory1 = selectedCategory1;
public void std_list_lbx_processValueChange(ValueChangeEvent vce) {
connection();
int n1 = 0;
String a = "";
if (con != null) {
try {
stmt = con.createStatement();
String query = "select std_id, std_name from std_detail";
rs = stmt.executeQuery(query);
String iddata = "";
if (rs != null) {
while (rs.next()) {
iddata = rs.getString("std_id");
// System.out.println(rs.getInt("std_id"));
stmt1 = con.createStatement();
String query1 = "select chpt_detail from chapter_detail right outer join std_detail on chapter_detail.std_id = std_detail.std_id where chapter_detail.std_id = " + iddata + " ";
String data3 = "";
rs1 = stmt1.executeQuery(query1);
if (rs1 != null) {
while (rs1.next()) {
data3 = rs1.getString("chpt_detail");
chpt_lst_lbx.setValue(data3);
dList2.add(data3);
stmt1.close();
rs1.close();
List selectItems = new ArrayList();
Iterator it = dList2.listIterator();
while (it.hasNext()) {
String label = (String) it.next();
chpt_lst_lbx.setValue(label);
selectItems.add(new SelectItem(label));
items2 = (SelectItem[]) selectItems.toArray(new SelectItem[0]);
stmt.close();
rs.close();
con.close();
} catch (Exception e) {
System.out.println("Sorry failed to display values from the database table. " + e.getMessage());
System.out.println(e);
}any idea or suggestion tell meYou usually use the property behind value="#{DynamicListBean.selectedCategory1}" for that. But in your case you'll need the vce.getNewValue() as the valueChangeListener is been invoked before the property is been set.
Having said that, your code is terrible. Please read on about the DAO pattern. Further on, did you know that you can also just use List<SelectItem> instead of SelectItem[] as f:selectItems value?
If you want to populate child menu's, you may find this article useful to avoid future and painful problems: [http://balusc.blogspot.com/2007/10/populate-child-menus.html]. -
Get selected values from Listbox control
Hi All,
I'm still new to SL so please bear with me.
I have a ListBox being bound with some records from a DB. Here's the xaml:
<ListBox x:Name="lstClassSeries" SelectionMode="Multiple" DisplayMemberPath="Description" Grid.Row="11" Grid.Column="1"></ListBox>
What I need is to get the values of the items that were selected and I can't seem to get it to work. I've tried looping through the SelectedItems but there's no property for value or text. I even tried to cast the item as a ListBoxItem but I
get the following error:
Unable to cast object of type 'UI.Silverlight.TransactionService.DTODropDown' to type 'System.Windows.Controls.ListBoxItem'.
How can I get the values of the items selected?
ThanksYou're using windows forms style techniques with xaml.
This is a bad idea.
You ought to learn MVVM.
You probably don't think you want to learn it, but trust me on this one.
Learn MVVM as soon as you can.
There's a selecteditems collection.
You have to cast to listboxitem, it has a content property which you cast to whatever you put in there originally.
Here's a snippet.
I have a class foo, load a bunch of them in. Do stuff. Work out what's selected in the click event of a button.
public class foo
public int id {get;set;}
public string description {get;set;}
public partial class MainPage : UserControl
public MainPage()
InitializeComponent();
lb.Items.Add(new ListBoxItem{Content=new foo{ id=1, description="a"}});
lb.Items.Add(new ListBoxItem { Content = new foo { id = 2, description = "b" } });
lb.Items.Add(new ListBoxItem { Content = new foo { id = 3, description = "c" } });
private void Button_Click(object sender, RoutedEventArgs e)
List<foo> selectedfoos = lb.SelectedItems.Cast<ListBoxItem>().Select(x=>x.Content as foo).ToList();
Hope that helps.
Recent Technet articles: Property List Editing;
Dynamic XAML -
Getting selected value from Listbox
Hi,
I have populated my listbox on the selection screen using the function module VRM_SET_VALUES.
How do I get the value which is selected from the list box.
Where is the selected value in the listbox stored.
Thanks,
AbhishekThe code I used is:
Another issue is that whenever I select any value in the listbox it is not displayed on the screen. It becomes blank again.
PARAMETERS: p_prin AS LISTBOX VISIBLE LENGTH 30 USER-COMMAND sele.
DATA: i_printers TYPE STANDARD TABLE OF frprlist,
wa_printers TYPE frprlist.
DATA: l_name TYPE vrm_id,
i_list TYPE vrm_values,
l_ctr TYPE i VALUE 0,
wa_value LIKE LINE OF i_list.
CLEAR: wa_value.
Get printers
CALL FUNCTION 'RSPO_FRONTEND_PRINTERS_FOR_DEV'
EXPORTING
device = p_print
TABLES
list = i_printers
EXCEPTIONS
no_list = 1
list_truncated = 2
name_not_found = 3
OTHERS = 4.
IF sy-subrc EQ 0.
Populate to drop down box
l_name = c_prin.
LOOP AT i_printers INTO wa_printers.
l_ctr = l_ctr + 1.
wa_value-key = l_ctr.
wa_value-text = wa_printers-prname.
APPEND wa_value TO i_list.
CLEAR wa_value.
ENDLOOP.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = l_name
values = i_list
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc NE 0.
Do nothing
ENDIF.
ENDIF.
CLEAR: l_name, l_ctr, wa_value, i_list. -
How to get select items from multi select in an array or list in jsp
i have the following multi select which is basically an array coming from the database how can select couple of them and put them in an array in jsp and then save them in the session so when i click the next button they continue till i reach the last finish button of my wizard:
<SELECT MULTIPLE SIZE=5>
<OPTION VALUE="o1">Option 1
<OPTION VALUE="o2">Option 2
<OPTION VALUE="o3">Option 3
<OPTION VALUE="o4">Option 4
<OPTION VALUE="o5">Option 5
<OPTION VALUE="o6">Option 6
</SELECT>
Option 1Option 2Option 3Option 4Option 5Option 6Hi,
As you are tracking changes in ALV data you must define a event handler for ALV evenr ONDATA_CHECK.
On defining an event handler you will be getting a structure called t_param.
It contains an element called t_deleted rows.
See this code to have an idea.
method ONDATACHECK .
DATA: x_delete_row LIKE LINE OF r_param->t_deleted_rows.
" i_addr_factr TYPE STANDARD TABLE OF ycot_addr_factr,
" x_addr_factr LIKE LINE OF i_addr_factr.
TYPES t_proj_constr TYPE ycot_proj_constr.
FIELD-SYMBOLS: <fs_row> TYPE t_proj_constr.
IF wd_comp_controller->ya_optyp = 'DELETE'.
LOOP AT r_param->t_deleted_rows INTO x_delete_row.
"x_addr_factr ?= x_delete_row-r_value.
ASSIGN x_delete_row-r_value->* TO <fs_row>.
DELETE FROM ycot_proj_constr WHERE plant = <fs_row>-plant
AND yr_nbr = <fs_row>-yr_nbr
AND period = <fs_row>-period
AND billback_pr_fmly = <fs_row>-billback_pr_fmly
AND prd_nm = <fs_row>-prd_nm.
ENDLOOP.
I hope it helps.
Regards,
Sumit Oberoi -
User Exit - Get Select Item from ME22n
Hi
I need get the select in me22n
is there any u-exit /badi with a parameter like actua_item or select_item?
thks and regards
Luis
Edited by: Luis Constantino on Sep 7, 2009 2:07 PMHi Margaret,
There are a few things in this form that may help. Look at the exit event of the dropdown.
https://acrobat.com/#d=khu3Ik*9LUz60afNWuCUsA
Hope that helps,
Niall -
How to get selected item from AutoSuggestBox in Windows Phone 8.1
In CS File "SelectedItem" is not working what is the alternative to "SelectedItem" for AutoSuggestBox in WP8.1
In XAML File:
<AutoSuggestBox x:Name="tblkpersonname" Width="380" Margin="0,-7,0,0" ItemsSource="{Binding}" TextChanged="tblkpersonname_TextChanged">
<AutoSuggestBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"
Tag="{Binding PersonID}"/>
</DataTemplate>
</AutoSuggestBox.ItemTemplate>
</AutoSuggestBox>
In Cs File:
private void tblkpersonname_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
try
if (tblkpersonname.SelectedItem != null)
tblkdes.Text = ((values)tblkpersonname.SelectedItem).Description;
persononlineimg.Source = new BitmapImage(new Uri(((values)tblkpersonname.SelectedItem).FlickrPersonImageUrl, UriKind.RelativeOrAbsolute));
catch (Exception ex)
Exceptions.SaveOrSendExceptions("Exception in tblkpersonname_SelectionChanged_1 Method In AddCast.cs file.", ex);
Devi Prasad.PHi
Not sure about the code you have mentioned here, there is no property named selecteditem in msdn. Please refer
https://msdn.microsoft.com/en-us/library/windows.ui.xaml.controls.autosuggestbox.aspx
<AutoSuggestBox x:Name="suggestions"HorizontalAlignment="Left" Margin="52,62,0,0"
ItemsSource="{Binding }"VerticalAlignment="Top"
Width="296" TextChanged="suggestions_TextChanged"
SuggestionChosen="suggestions_SuggestionChosen"/>private void suggestions_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
Suggestions.Clear();
Suggestions.Add(sender.Text + "Tea");
Suggestions.Add(sender.Text + "Tatt");
private void suggestions_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
suggestions.Text = "Choosen";
Something like this can be used
Regards
Varun Ravindranath Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. -
Getting multiple items from a Jlist
hi i am trying to get selected items from a Jlist to print out
but can only seem to get one item at a time using getSelectedValue()
when i try and use getSelectedValues().toString(); i get
the following print out [Ljava.lang.Object;@ed783f68 can anyone show me
where i am going wrong and tell me why i get that print out
cheers
submitdetails.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent e )
String data = privilegesList.getSelectedValue().toString();
Object data2 = privilegesList.getSelectedValues().toString();
System.out.println(data);
System.out.println(data2);
The getSelectedValues(...) method returns and ARRAY of OBJECTS. You have to loop through the array to get each object separately:
Object[] values = privilegesList.getSelectedValues();
for (int j = 0; j < values.length; j++)
System.out.println ( values[j].toString() ); -
How to get selected values from selectManyCheckbox ?
Hi,
I am a SOA developer and using 'Auto generated adf form' of Human Task. I did some customization in the form. I need to show one dynamic list (contains multiple string values) on a form, from which user will select desired values. For this I have used <af:selectManyCheckbox> adf component.
It has generated code as follows...
<af:selectManyCheckbox value="#{bindings.Response.inputValue}"
label="#{bindings.Response.label}"
id="smc1">
<f:selectItems value="#{bindings.Response.items}" id="si9"/>
</af:selectManyCheckbox>
I am able to show list on a form and can select multiple values also.
Now, I want the multiple selected values back in my BPEL process. I need only those values which are selected by user.
Currently I am getting complete list as it is back in BPEL process.
Please help me out..!
Thanks..
SurajUnwinding ADF: How to retrieve Selected Items from selectManyCheckbox using ValueChnageListener
-
How to get selected value from SelectOneChoice
Hi,
I'm facing a problem to get selected value from SelectOneChoice. I have valueChangeListener event on a (SelectOneChoice)item. After user makes a choice I want to store selected value in a bean property to pass it to a method.
For example List item shows dname from dept table after user makes a choice I want to get deptno and populate into bean which I use to pass into my method.
If I use valueChangeEvent.getNewValue() I always get negative value instead I want deptno selected. Sample code pasted below.
public void setDeptno(ValueChangeEvent valueChangeEvent) {
BindingContainer b = getBindings();
OperationBinding oB = b.getOperationBinding("setDeptno");
//Checking instance of because same method is called from another text inputText item.
if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
if (columnName.getId().toString().equals("deptDname")){
JSFUtils.setManagedBeanValue("dept.deptDeptno",valueChangeEvent.getNewValue());
}if your selectOneChoice has value equal to #{bindings.deptno} bound to the iterator Dept1Iterator,
then the backing code will look more like
public void setDeptno(ValueChangeEvent valueChangeEvent) {
BindingContainer b = getBindings();
OperationBinding oB = b.getOperationBinding("setDeptno");
//Checking instance of because same method is called from another text inputText item.
if (valueChangeEvent.getSource() instanceof CoreSelectOneChoice){
CoreSelectOneChoice cN = (CoreSelectOneChoice)valueChangeEvent.getSource();
if (columnName.getId().toString().equals("deptDname")){
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
ValueBinding bind = app.createValueBinding("#{bindings.Dept1Iterator.currentRow}");
Row row = (Row)bind.getValue(ctx);
JSFUtils.setManagedBeanValue("dept.deptDeptno", row.getAttribute("deptno"));
} I haven't tested it, so it could perfectly not work at all -
Hi all,
I am making a vi where I have to save the selected value from listbox with its respective tab control dropdown selcted values in another listbox.Whenever I select Item1 then the heading change and respective tab will open for that item.But Now I just want to save the selection and put it in another ListBox.SO that I can renmove or add according to my wish. Plz help me.
Solved!
Go to Solution.
Attachments:
my_vi.png 83 KBHi, I successfully make the vi to insert itmes from listbox1 to listbox2.Whenever I select itmes 1 in listbox 1 it display same elected item in listbox2 , but it not appending the items in listbox2.Like If 1 is selected in listbox1 then 1 will display , next time after saving when I selct next item like 3 then in listbox 2, 1 is replaced by 3,it dont come in second row of listbox2.Hope I am able to explain.\
Plz help me to resolve this.
Attachments:
listbox_update.vi 11 KB
Maybe you are looking for
-
How to find out the Trace file
Hi Dba's I need to find out the trace file with the Request id. how can i find out it? Thanks
-
My Iphone was stolen. How do I remotely wipe it?
My iPhone was stolen. How do I remotely wipe it? Is there anything else I need to do?
-
Clear open GL items ??
Dears, I am new to oracle, previously I was using SAP, and I wonder if oracle have the same capability to view the GL entries as open items (non cleared entries), and if there is any possibility to clear B/S GL accounts. "such feature in SAP is calle
-
Failover cluster validation errors
We are trying to set up a failover cluster file server between two domain controllers running Windows Server 2012 RC. When we go through the Validate Configuration wizard, we receive the following errors messages against the Active Directory configur
-
Diffrence between Oracle BI Publisher and OBIEE
Now iam using SQL Server Reporting Services (SSRS). I want to migrate SSRS to Oracle Reports. I want to know the diffrence between Oracle BI Publisher and Oracle Business Intellingence Enterprise Edition (OBIEE). Which one is the best tool to generat