[Dual List Box] Duplicate component

Forge Component
Published on 2018-02-26 by João Melo
0 votes
Published on 2018-02-26 by João Melo

No, it is not!

Dual List Box is more lightweight as it uses ONLY jQuery, running in the browser. So no overload of requests to the server.

Sure our community users will have the oportunity to chose which one fits better their needs. ;)

João, I've tried your component and I have couple of questions for you.

When I open my Form I have ListBox1 with (all countries) and ListBox2 with (Portugal and Spain selected). When I click OK, it saves the ListBox2 records (CountryId) into the Database. So far so good. 

The "problem" is when I open the same form for Editing and I want to show on ListBox 2 the countries that were previously saved and on ListBox1 all the countries but the ones saved to the database.

Of course If I want to open the same form for a new Record, the ListBox1 must show all the countries and ListBox 2 must be empty.

Can you help me out on how do I achieve this?

Hi Hugo. Note that you need to do 2 queries to the database. One for each Listbox. To do so, simply grab the records for the ListBox 1 that are not in the Listbox 2. You can use an advanced query with a NOT EXISTS clause.