aris
1
Hello, i have one problem
How do I insert a list from the database in a listbox
Example i trying
$row_user = $db.execute( “SELECT user FROM usuarios” )
$row_user.each do |row|
@users = list_box :items => [row[0]]
end
but I know he has repeated many list box
tried
@users = list_box :items => $row_user
but returns values with ["_"]
Hi Danilo,
Although I don’t know the structure/format of your database.
Try out the following snippet.
Shoes.app do
row_user = [[‘Danilo’, ‘Apple’, 2012], [‘ashbb’, ‘Orange’, 1999]]
list_box items: row_user.map{|row| row.map(&:to_s).join(’ ')}
end
The Shoes-list_box-items should have an array not nested.
Hope this helps,
ashbb
Thanks man, its worked
but i discovery other form
Shoes.app do
users = [[“peter”], [“joe”]]
stack do
users = list_box :items => users.flatten
end