Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Interfere right after an e.g. ListBox has been populated
Interfere right after an e.g. ListBox has been populated [message #1814247] Fri, 06 September 2019 10:52 Go to next message
Faruk Caglar is currently offline Faruk CaglarFriend
Messages: 33
Registered: August 2019
Member
Hi,

I have a ListBox which will be populated from a Lookup which is based on a DB-table.. When the ListBox show up all rows are unchecked. Due to some conditions (input from another DB-table,) I would like to decide which rows need to be checked ..

I could not find out which method or were to interfere..

Thanks!



Re: Interfere right after an e.g. ListBox has been populated [message #1814250 is a reply to message #1814247] Fri, 06 September 2019 11:00 Go to previous messageGo to next message
Matthias OtterbachFriend
Messages: 55
Registered: August 2015
Location: Munich
Member
Without having tested it I think you can use the method org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox.checkKeys(Collection<? extends KEY>) to check specific rows of the list box for example after some other action has occurred or after the form has been loaded.

As you want to check the rows depending on some database condition you could for example call the method above in the org.eclipse.scout.rt.client.ui.form.AbstractFormHandler.execPostLoad() and check all keys depending on another service call (or maybe even a property already set to avoid an additional service call)? If you want to check the keys immediately after the list box table data has been populated you might also be able to just overwrite the org.eclipse.scout.rt.client.ui.form.fields.listbox.AbstractListBox.execPopulateTable() method, call the super-method and check the keys using the method above.

[Updated on: Fri, 06 September 2019 11:02]

Report message to a moderator

Re: Interfere right after an e.g. ListBox has been populated [message #1814311 is a reply to message #1814250] Mon, 09 September 2019 09:36 Go to previous messageGo to next message
Faruk Caglar is currently offline Faruk CaglarFriend
Messages: 33
Registered: August 2019
Member
thanks. That works,

One more question: There are methods getCheckedKeys() and getUncheckedKeys() for the ListBox, which gives the checked/unchecked keys. The returned keys are the keys which have been checked/unchecked since the load/init.

Due to the fact, that I manipulate the checked/unchecked keys within execPopulateTable() (after the execPopulateTable()) the getCheckedKeys() provides the checked keys fater loading but before manipulating. Is there a way to set to starting point after the manipulation?

Thanks!

Re: Interfere right after an e.g. ListBox has been populated [message #1814336 is a reply to message #1814311] Mon, 09 September 2019 16:00 Go to previous messageGo to next message
Patrick Baenziger is currently offline Patrick BaenzigerFriend
Messages: 96
Registered: September 2011
Member
If I'm reading the code right, that's only partially true: The getCheckedKeys method of Listbox always returns the current state (=value) of the Listbox, not the keys that have been checked after the load.
The getUncheckedKeys method does return the keys that have been unchecked since the "initial state". Of course you can compute easily which keys have been checked since the load (getCheckedKey() minus getInitValue()).

You can set the initial state either manually to a specifc value (setInitValue), or to the current value (by calling markSaved). The latter is the same behaviour that happens after the "execLoad" method of your handler completes.
Beware: If used incorrectly, this can lead to suble bugs of your data not being saved because the state is not recognized as "changed".
Re: Interfere right after an e.g. ListBox has been populated [message #1814481 is a reply to message #1814336] Thu, 12 September 2019 06:59 Go to previous message
Faruk Caglar is currently offline Faruk CaglarFriend
Messages: 33
Registered: August 2019
Member
thanks!
Previous Topic:SSL for Jetty
Next Topic:Calling a TablePage from somewhere other than the Outline
Goto Forum:
  


Current Time: Sat Apr 20 06:29:45 GMT 2024

Powered by FUDForum. Page generated in 0.03832 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top