How do I load a list of a textbox from a view.


Suppose we have the table test.Categoty formed by two columns ID and Name, to load the textbox we should use the following code:

dataweb.util.treeset.WebDataSet wds = client.getData(session, "text.Category");
for (int i=0;i<=wds.getRowCount()-1;i++){
   textBox1.listAddItem(new dataweb.client.components.textbox.ListValueLabel(wds.getValue(i,"ID"),wds.getValue(i,"Name")));

The example could also be used directly:


Instead, we used the class dataweb.client.components.textbox.ListValueLabel this because we are interested see the name of the category, but we know what his ID. To get this we use the following methods:

textBox1.getSelectedItem().getValue() //Returns the id of the category
textBox1.getSelectedItem().getLabel() //Returns the name of the category

Published in Mon, 27 December 2010 15:34