ComboBox and DataTable

Hey All,
I have found a lot of posts on here about adding values to a combo box using the valid values collection. I am trying to assign a datatable to the Combobox in my case. I add my datatable in the xml and assign a query to it. Then I assign that to the databind property of the combobox and when the form loads it only displays the 1st record in the query.
Any ideas what I am doing wrong?
I basically just want to display the list of item groups in my combo box without manually adding these to the valid values collection.

Hi Curtis.
If it can help you this is some methods used in my programs:
1) ValidValues in xml file
<item uid="cType" type="113" left="100" tab_order="0"
         width="150" top="10" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="1"
         right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0"
  <AutoManagedAttribute />
  <specific AffectsFormMode="1" TabOrder="0">
    <action type="add">
     <ValidValue value="A" description="AAA" />
     <ValidValue value="E" description="EEE" />
     <ValidValue value="B" description="BB" />
     <ValidValue value="D" description="DD" />
  <databind databound="1" table="@TABLE_A" alias="U_TYPE" />
2) Add ValidValues to combobox.
Private Sub CreateForm()
    Dim oForm As SAPbouiCOM.Form
    Dim oComboBox As SAPbouiCOM.ComboBox
    Set oForm = SBO_Application.Forms.Add("MYFORM")
    oForm.DataSources.UserDataSources.Add "DS", dt_SHORT_TEXT, 20
    Set oComboBox = oForm.Items.Add("cCombo1", it_COMBO_BOX).Specific
    oComboBox.DataBind.SetBound True, "", "DS"
    oComboBox.ValidValues.Add "A", "Value A"
    oComboBox.ValidValues.Add "B", "Value B"
    oComboBox.ValidValues.Add "C", "Value C"
End Sub
3) Add Linked Table for field.
See this thread [User defined Valid values in SBO|User defined Valid values in SBO;
4) Recordset
See this thread [Fill values in combobox from database table|Fill values in combobox from database table;
5) LoadSeries Method (look SDK Help)
Other ways  I don't know.
Best regards
Sierdna S.

Similar Messages

  • Castom ComboBox and lose binding

    Hello. I'm trying to write my own ComboBox and I ran into a problem.
    public class TestComboBox : ComboBox
    public static readonly DependencyProperty SelectedCarProperty = DependencyProperty.Register("SelectedCar", typeof(string), typeof(TestComboBox), new FrameworkPropertyMetadata(null, OnSelectedCarPropertyChanged));
    public TestComboBox()
    this.Cars = new ObservableCollection<string>() { "Select Car", "BMW", "Mersedes", "Audi" };
    this.ItemsSource = this.Cars;
    this.SelectedItem = this.Cars[0];
    public string SelectedCar
    get { return (string)GetValue(SelectedCarProperty); }
    set { this.SetValue(SelectedCarProperty, value); }
    public IList<string> Cars { get; private set; }
    protected override void OnSelectionChanged(SelectionChangedEventArgs e)
    this.SelectedCar = (string)SelectedItem;
    private static void OnSelectedCarPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
    var car = (string)e.NewValue;
    var editor = (TestComboBox)source;
    editor.SelectedItem = car;
    When I try to install the default value, I lose the binding. If I commented this code, everything works fine.
    this.SelectedItem = this.Cars[0];
    How can I set the default value without losing binding to the VM

    I use this code.
    <propgrid:PropertyGrid Margin="0,0,11,7">
    <propgrid:PropertyGridCategoryItem DisplayName="Main">
    <propgrid:PropertyGridPropertyItem Value="{Binding Car, Mode=TwoWay}"
    <wpfApplication1:TestComboBox SelectedCar="{Binding Value, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}}" />
    I found a solution my problem Ijust replacedthe code
    this.SelectedItem = this.Cars[0];
    with this
    this.Loaded += (sender, args) =>
    if (this.SelectedItem == null)
    this.SelectedItem = this.Cars[0];
    And now everything works fine

  • How do i split a line in a csv file and populate a combobox and a textbox with the parts

    What I'm trying to do is split the line and fill a combobox and with the selecteditem and the textbox with the value of the combobox selecteditem which is the second part of the line split.
    Thanks in advance for the help or suggestions.

    Then you should create a class to represent the items in the ComboBox:
    Public Class MyItem
    Public Property PartA As String
    Public Property PartB As String
    End Class
    ...and add instances of this class to the ComboBox:
    Dim mydocpath1 As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    Dim mylines() As String = File.ReadAllLines(mydocpath1 + "\TextFile1.txt")
    For Each line In mylines
    Dim parts() As String = line.Split(","c)
    Dim item As MyItem = New MyItem With {.PartA = parts(0), .PartB = parts(1)}
    Next line
    cmb1.SelectedItem = cmb1.Items(1) 'select second item
    Catch ex As Exception
    End Try
    Then you set the DisplayMemberPath of the ComboBox to the name of one property and bind the Text property of the TextBlock to the other one:
    <ComboBox Name="cmb1" DisplayMemberPath="PartA" />
    <TextBlock Text="{Binding ElementName=cmb1, Path=SelectedItem.PartB}" />
    That should solve your issue.
    Once again, please remember to mark helpful posts as answer to close your threads and remember that a new thread deserves a new question.

  • Combobox and checkbox in jexcelapi

    Hay Gays,
    with Writing Spreadsheets i want to cells which contain combobox and other cells which contain checkbox ,i need help with that i tried alot of things ?

    You simply write your own TableCellRenderer that returns a different Component instance for each row.
    It could do this by having three TableCellRenderers installed in it and it simply delegates the call to getTableCellRendererComponent to the appropriate renderer:
    public class CompositeTablecellRenderer implements TableCellRenderer
      private TableCellRenderer[] cellRenderers;
      public CompositeTablecellRenderer()
        // create your nested renderers here
      public Component getTableCellRendererComponent(...)
        TableCellRenderer renderer = cellRenderers[row % cellRenderers.length]; // For example!
        return renderer.getTableCellRendererComponent(...);
    }It's up to your application to determine which renderer to use for which row. Cell editors create another level of complexity but it's still achievable (I wrote one that mapped Class to TableCellRenderer so it could determine the renderer based on the value's class at runtime - it sort of works but subclasses prove tricky).
    Hope this helps.

  • Combobox and button renderer

    Hi all,
    I read the documentation about JTables but couldn't figure out how to solve my problem. I want to render combobox and button in the same JTable cell like in Netbeans. How can I do this? Any suggestions?

    Anyone with ideas?

  • [svn:fx-trunk] 11737: ComboBox and DropDownList bug fixes

    Revision: 11737
    Author:   [email protected]
    Date:     2009-11-12 13:25:33 -0800 (Thu, 12 Nov 2009)
    Log Message:
    ComboBox and DropDownList bug fixes
    SDK-23635 - Implement type-ahead in DropDownList
    Added code in DropDownListBase keyDownHandler to listen for letters and change the selection if there is a match. At some point, we should modify findKey and findString (I'll file an ECR for that). For now, I've just overridden findKey and cobbled together the logic from List.findKey and List.findString. In ComboBox, we override findKey to do nothing since ComboBox has its own logic that relies on textInput changes.
    SDK-23859 - DropDownList does not reset caretIndex when selection is cleared
    Fixed this in two places. In ComboBox.keyDownHandlerHelper, we update the caret index when ESC is pressed. In DropDownListBase.dropDownController_closeHandler, we update the caret index if the commit has been canceled (ie. ESC was pressed).
    SDK-24175 - ComboBox does not select an item with ENTER when openOnInput = false
    When the ComboBox was closed and the arrow keys were pressed, the selectedIndex was changed. When ENTER was pressed, it was committing actualProposedSelectedIndex, not selectedIndex. The fix is to override the selectedIndex setter to keep actualProposedSelectedIndex in sync if selectedIndex was changed. Usually it is kept in sync when the dropDown is opened.
    SDK-24174 - ComboBox does not scroll correctly when openOnInput = false
    When typing in a match, the caretIndex was changed, but not the selectedIndex (because matching when it is closed doesn't commit the value until you press ENTER or lose focus). When closed, the navigation keys were changing the selectedIndex relative to the previous selectedIndex. I updated this to change relative to caretIndex instead. In most cases, caretIndex and selectedIndex are equivalent while the dropDown is closed.
    Other changes:
    - Replaced some calls to dropDownController.isOpen with isDropDownOpen.
    - Added protection RTE protection to ComboBox.changeHighlightedSelection
    QE notes: None
    Doc notes: None
    Bugs: SDK-23635, SDK-23859, SDK-24175, SDK-24174
    Reviewer: Deepa
    Tests run: ComboBox, DropDownList
    Is noteworthy for integration: No
    Ticket Links:
    Modified Paths:

    This bug figures out also when creating a custom spark ComboBox, then trying to programatically update the userProposedSelectedIndex property. The proposed selected index is selected, but does not apply the same skin as when mouse is on rollover or item is selected due to up and down keys.
    The issue seems like updating the status of the item renderer to rollover or selected to get the same skin applied.
    Please could you attach DropDow that you edited ?
    Thank you so much.

  • Need example of backing bean for selectBooleanCheckbox and dataTable

    Does anyone have an example backing bean for selectBooleanCheckbox and dataTable combination?
    I am trying to figure out how to create a dataTable with one column of checkboxes, when the checkboxes are selected, need to get a collection of all records that were selected.
    Also need to identify one of the columns in the records that were selected and send it to the EJB services to do update.
    columns in dataTable are userid and name. Both are string values.

    What is the difference between myDataItem, myDataItems and myDataList in
    Where did myDataItem and myDataList come from? It isn't declared or initialized in

  • ComboBox and JList working to gether?

    Is it possible to get ComboBox and JList to work together?
    In the ComboBox there are 3 options to pick. Football, Hockey and Baseball. When one of these are picked all the names of the players
    from for example football is shown in a JList.
    Is this possbile? If yes how? can you give example or link to toturial?

    do you know a tutorial on this?Did you read the API for either JComboBox or JList????????
    Both contain links to the Swing tutorial.
    And why is it so difficult to post a Swing related question in the Swing forum???????

  • ComboBox and TextInput

    I have to add a change event listener... 
    I did add one something like this.... 
    Private function Change(event:Event):void{
    <mx:TextInput id="inputtxt"/>
    <mx:Button id="searchBtn" label="Search" change="Change(event)"/>
    ***This does nothing for me though***
    [Bindable] public var Emp:String;
    [Bindable] public var ary:Array = ["Emp name", "Emp number", "Emp id"];
    This is my combobox array now I have a text box next it, so that the user can enter name, number or id...
    What should be in my change function?, I have:
    private function change():void{
              if  (cb.selectedIndex==0)
              else if (cbEmp.selectedIndex==1)
    <mx:ComboBox id="cb" dataProvider="{ary}"/>
    and how do I store what user has enter....
    which one is the right approach and how will they work... I'm just a little confused....

    can you show me how to incorporate valueCommit with TextInput, combobox and search and I do have to search based on what the used enter...
    So if I have
    [Bindable] public var Emp:String;
    [Bindable] public var ary:Array = ["Emp name", "Emp number", "Emp id"];
    <mx:ComboBox id="cb" dataProvider="{ary}"/>
    <mx:TextInput id="inputtxt"/>
    <mx:Button id="searchBtn" label="Search"/>
    <mx:ViewStack id="vs">
    <src:Ref id="vsRef"/>
    Now what I want to do is when the user enter either Employee Name or Number or ID in the textInput box next to the combobox filter based on what is selected in combobox (name, number or id) I have to bring up the viewstack which shows the datagrid with data based on what the user has input...
    Can anyone help me with how do I incoprporate valueCommit or cb.selectedItem....
    I'll really appreciate that.

  • Difference between panelGrid tag and dataTable

    what is the difference between panelGrid tag and dataTable tag in jsf

    A panelGrid is useful when you have a fixed number of rows and columns. Each child component of the panelGrid is specified explicitly and arranged in a grid by the parent component.
    A dataTable is useful when you have a collection of homogeneous data of indeterminate size. You specify the columns of the dataTable and it will iterate over your data creating one row per datum.

  • Performance problems with combobox and datasource

    We have a perfomance problem, when we are connecting a datatable object or something like this to a datasource property of a combobox. Below you find the source code. The SQL-Statement reads about 40000 rows and the result (all 40000) should be listed in the combobox. There is duration about 30 second before this process has finished. Any suggestions?
    Dim ds As New DataSet
    strSQL = "Select * from"
    conn = New Oracle.DataAccess.Client.OracleConnection(Configuration.ConfigurationSettings.AppSettings("conORA"))
    comm = New Oracle.DataAccess.Client.OracleCommand(strSQL)
    da = New Oracle.DataAccess.Client.OracleDataAdapter(strSQL, conn)
    Dim dt As New DataTable
    dt = ds.Tables(0)
    ComboBox1.DataSource = dt
    ComboBox1.ValueMember = dv.Table.Columns("id").ColumnName
    ComboBox1.DisplayMember = dv.Table.Columns("city").ColumnName

    But how long does it take to fill the DataTable?
    I can fill a 40000 row datatable in under 4 seconds.
    DataBinding a combo box to that many rows is pretty expensive, and not normally recommended.
    Dim strConnection As String = "Data Source=oracle;User ID=scott;Password=tiger;"
    Dim conn As OracleConnection = New OracleConnection(strConnection)
    Dim cmd As New OracleCommand("select * from (select * from all_objects union all select * from all_objects) where rownum <= 40000", conn)
    Dim ds As New DataSet()
    Dim da As New OracleDataAdapter(cmd)
    Dim begin As Date = Now
    Console.WriteLine(ds.Tables(0).Rows.Count & " rows loaded in " & Now.Subtract(begin).TotalSeconds & " seconds")
    40000 rows loaded in 3.734375 seconds

  • Af:query how to control the query combobox and change it's label text

    My colleague designed a well working af:query search page with several selectable predefined queries. Now it's up to me to control this combobox from outside the component with big colored buttons for user convenience. If the user clicks on one of the big buttons, the assigned item of the combobox is selected and then the query is submitted.
    I though about doing this with javascript, but the difficulty is, that I have no idea and didn't find a way to reference the id of the combobox? The combobox is a 'built in' component in he af:query component and there is no way to give it an id in the properties.
    The second problem is that I didn't find a way to change the label text of the combobox. It seems to be hard coded?
    Thanks in advance for your suggestion!

    the text should be coming from a message bundle and some other look and feel related elements should be settable through skinning in CSS
    search for af|query
    Regarding the JavaScript access, use firebug JS debugger. The af query class is AdfRichQuery.js
    Note however that you should be able to do in Java what you are aimning for in JavaScript. However the usecase you want to implement is not fully clear to me - to be honest

  • ComboBox and button symbol interaction

    (Sorry-- I had this posted in ActionScript as well -- not
    really an AS issue...)
    I thought it would be easier for folks if they didn't have to
    create this from scratch:
    Here is the
    and the
    Greetings --
    I traced back a bug that I was having to its most basic level
    and was surprised that it happens with only a ComboBox component
    and a button symbol... I traced it back so far that it got rid of
    all of my ActionScript and was left with only these two interface
    Set-up: Create a new Flash document, ActionScript 2 / Flash
    8. Drag in a combobox component and add a label. Create a new
    button symbol and define up, over, down and hit states and drag
    this in as well...
    When you try test this movie, you get strange behavior...
    Give the button a few clicks to see that it is working properly.
    Then, click on the combobox to open it and then go back to the
    button. The button will work the first time tried, but will not
    work properly with subsequent attempts. It seems that the states of
    the button are getting confused after the combobox is used?
    Could there be a work-around to this? Thank you in advance
    for you assistance with this issue...!

    I have Flash Player 9 (9,0,115,0) on my Mac, and am getting
    the same behavior on Windows XP...
    Perhaps try not moving the mouse between subsequent clicks
    will make it more apparent... I select something from the combobox.
    Then, the first click on the button works properly... but when you
    release the button (and don't move the mouse) it returns to the "up
    state" (not "over state"). Additional clicks don't respond with a
    "down state"... it just flashes the "over state" momentarily.
    It's causing me troubles because my interface asks users to
    first select from a combobox to navigate and then they can click to
    subsequent items with a button: next, next, next... to page through
    the selection. But this strange interaction is hanging up the next
    button on the second click (it never gets the down state).
    Thanks for checking it out... I sure would appreciate any
    thoughts on the matter...

  • Escape key "dies" in combobox and JTable

    I have set in my JDialog the default key ESCAPE as this standard code:
              KeyStroke escKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
              int param = JComponent.WHEN_IN_FOCUSED_WINDOW;
              root.getInputMap(param).put(escKey, "close");
              root.getActionMap().put("close", actionCancel);
    The problem is when I have JComboBoxs and JTables. All key events seem to be consumed
    In this components (and maybe more components). So, if I press ESCAPE and my focus
    in a combobox, the dialog won't close.
    How could I work around this?
    thank you

    I've got the solution!
    I have a javaBean (JPanel) that has only one JComboBox. I trigger key pressed (don't know
    if should be key released in this case) on comboBox. Then I check if...
    Simple. If popup is not visible and dispatch the event to this.
    I just wonder how the event goes to my javaBean, my javabean is in a dialog and this
    dialog of mine ends up to catch the event. ???
    Ok, this stays has a solution for future developers to found - in case they guess that
    right keywords :)

  • ComboBox and data provider

    i need to populate a combo box with values form an
    ArrayColection that contains objects, how can i sepecify the field
    of each object in the array that should be displayed in the combo
    box ??

    Using the labelField property of the ComboBox.
    For further information please refer to the language
    reference, this contains all the properties of all the Flex
    components and how they are used.

Maybe you are looking for

  • I want to move all my purchases from one apple ID to another! How to do it?

    Hi there! I have this old email that will shut down in some time and i need to move all my purchases from it to my new Apple ID! How can I do it? Is there any way of doing this? Thanks

  • Delay time putting Mac Mini to sleep manually

    I am using an early 2011 Mac Mini running OS 10.6.7, which I have had for a little over a year. A new problem cropped up in the past week. When I put it to sleep manually it takes 2 minutes or more before it actually goes to sleep. I have "wake for n

  • Export text as word document

    Hi, I have a projector which generates a report for the user at the end of a Q&A section. Currently the report is saved as plain text. The client would like to add some text formatting (in the form of bold and coloured text) and would also like the f

  • Trying to compile firefox nightly

    I was hoping to do the equivalent of what heftig did for aurora and compile firefox nightly into its own package. First things first is getting the source code to succesfully compile at all before worrying about how its packaged. Here's my PKGBUILD:

  • Same files, two different play sequences

    This is probably a stupid question, but I don't know DVD Studio that well. The situation: I have 8 separate video files. They need to be able to be played individually (coming back to a menu at the end of each video), and to be played through complet