Listbox and ListView

Posted: 2017-01-19 in Listbox and ListView

Q:
is it possible to populate listbox and listview with more than one column ?
A:
Have you looked at the Canvas Section ‘TreeGrid‘ control? Specify the text for the ‘Header labels’ and a SQL Select statement for ‘List items’. In the ‘click’ event you can get x.CurrentItem.text, CurrentItem being the currently selected treeitem object.
Or, in a Form Section, you can use the Grid gadget for multiple columns.
A2:
If there is a reason you HAVE to use a list instead of grid, you could concatenate the result of a query, but I don’t recommend it.
This would work, but it would look ugly unless you forced some blank characters in to align it.

Code:
select first_name+" "+last_name from example

Q:
LIST VIEW. I noticed that you can set text as items, can I populate it with table fields?
A:
I add the items by using additems().
Like so.
I named the listview gadget list1.

Code:
mylistview=Lianja.get("page1.section2.list1")
mylistview.additems("select last_name from example")

Q:
tried this;

field1 is in a canvas section with listbox
testadress is the table.

Code:
proc page1_section1_field1_ready()
x=Lianja.get("page1.section1.field1")
x.additems="select name from testadress"
endproc

Also in Load or activate.
Does’nt work, listbox won’t populate, stay’s empty.
Tried it in Form section with List view, same result.
A:
Additems() is a method not a property.
replace this

Code:
x.additems="select name from testadress"

With this

Code:
x.additems("select name from testadress")

Q:
in which event additems method can be used to load initial value in the list or combo item when the app starts.
A:
Use the ‘ready’ event. During development in the Lianja App Builder, the ‘ready’ event is called when the App is loaded, so just save and reload the App to force the ‘ready’ event to be called and see your new code.


An example of using a draggable list to visually reorder records.
Lianja OrderedLists – https://youtu.be/9Vswi2GkcHw



 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s