I am still having major trouble with this if anyone can please help.

Here is exactly what I am doing:

I have made my own class of ComboBox that gets values from a database in pairs 
of [id]=>[text value];

The [text value] is the visible part in the dropdown, while the [id] is the 
value of the selected item. This id is stored in the database when the record 
is saved.

This part works fine.

The problem is when I display a record for editing, I want to setSelected the 
relevant item in the dropdown, using the id again supplied from the database.

I have this function which I pass the ComboBox object, and the id value of the 
list item I am trying to select:

function setComboDefault(combo, leftValue) {
 listItem = (combo.getList().getChildren()[leftValue]);
 combo.setSelected(listItem);
}

This function only works by the native index of the ComboBox (e.g. 0 to N). 

Obviously, ComboBoxEx would solve my problem rather easily, however there is a 
bug in this object where it cannot be used on a Window.

So what I need to do can be seen in this algorthym:

function setComboDefault(Object ComboBox, String IdValue) {
    
    ListItems = get all list items of ComboBox

    for(each ListItems as ListItem) {
        if (ListItem value == IdValue) {
            ComboBox.setSelected(ListItem);
        }
    }
}

Can anyone help with this please?

Aaron
  ----- Original Message ----- 
  From: Aaron Cooper 
  To: qooxdoo Development 
  Sent: Wednesday, November 22, 2006 5:59 PM
  Subject: Re: [qooxdoo-devel] Setting Combobox Default ListItem


  Thanks mate, that does work, but I had to be able to set it using the 
initalVal parameter I passed to the function, with out using a loop.

  easily done with if-else with two items but some of them have many items, and 
are dynamic.

  This is what I came up with and it works:

  field.setSelected(field.getList().getChildren()[initialVal]);

  Cheers
  Aaron
    ----- Original Message ----- 
    From: Jonathan Viney 
    To: qooxdoo Development 
    Sent: Wednesday, November 22, 2006 3:46 PM
    Subject: Re: [qooxdoo-devel] Setting Combobox Default ListItem


    field.setSelected(item_no);

    Just a guess....

    -Jonathan.


    On 11/22/06, Aaron Cooper <[EMAIL PROTECTED] > wrote: 
      Hi Guys,

      Spent a good 3 hours trying to do this simple task, and can't find the 
way of doing it in the API or Demos.

      Take this simple Yes/No Combobox class that I have made:

      function ftmDataEntryYesNo (name, xPos, initialVal) {
       var field = new qx.ui.form.ComboBox();
       field.setCssClassName("ftm-text-fields");
       field.setTop(xPos);
       field.setWidth(75);
       field.tagName = name;
       
       var item_no = new qx.ui.form.ListItem("No");
       item_no.setValue(0);
       
       var item_yes = new qx.ui.form.ListItem("Yes");
       item_yes.setValue(1);
       
       field.add(item_no, item_yes);
       
       //Set the initial value
       field.setSelected(field.getList().item_no);
       
       return field;
      }

      What is wrong there? I know about field.getList().getLastChild(), the 
above code came from a demo example using it. But how do I select a specific 
child?

      Cheers
      Aaron

      -------------------------------------------------------------------------
      Take Surveys. Earn Cash. Influence the Future of IT
      Join SourceForge.net's Techsay panel and you'll get the chance to share 
your
      opinions on IT & business topics through brief surveys - and earn cash 
      http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 

      _______________________________________________
      qooxdoo-devel mailing list
      [email protected] 
      https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel







----------------------------------------------------------------------------


    -------------------------------------------------------------------------
    Take Surveys. Earn Cash. Influence the Future of IT
    Join SourceForge.net's Techsay panel and you'll get the chance to share your
    opinions on IT & business topics through brief surveys - and earn cash
    http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV 


----------------------------------------------------------------------------


    _______________________________________________
    qooxdoo-devel mailing list
    [email protected]
    https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------


  -------------------------------------------------------------------------
  Take Surveys. Earn Cash. Influence the Future of IT
  Join SourceForge.net's Techsay panel and you'll get the chance to share your
  opinions on IT & business topics through brief surveys - and earn cash
  http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


------------------------------------------------------------------------------


  _______________________________________________
  qooxdoo-devel mailing list
  [email protected]
  https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to