Create a Multi-Selection and Rank tab
The purpose of this post is to help you create a tab where you can (1) choose records among a list and (2) specify the order of the chosen records.
Easy Option
The easiest option is to use iDempiere's built-in multi-selection/chooser feature. Do the following to see an example:
- Open the Print Format window => Choose any record
- Notice the Display Order and Sort Order sub-tabs
- Both Display Order and Sort Order sub-tabs allow you to choose if something is (1) included or not and (2) the importance or rank if included.
To see how this window is created:
- Log in as System Admin role
- Open the Window, Tab and Field window and find the 'Print Format' record
- Navigate to the Tab sub-tab.
- Find either the 'Display Order' or 'Sort Order' record
- Notice that the Order Tab checkbox is checked for this tab
- When the Order Tab checkbox is checked, it exposes two fields
- Order Column field
- Included Column field
- In the Included column, choose a boolean that will represent which records are included
- In the Order Column, choose a numeric field that will represent that records importance or rank among its included peers.
Here is a list of windows that use the above feature:
select w.name as windowname, t.name as tabname
from ad_tab t
join ad_window w on (t.ad_window_id = w.ad_window_id)
where t.issorttab = 'Y'
Advanced Option
If the above does not satisfy your needs, then you can move to something more advanced. Be aware that the above example is easy to create. The below example is much more difficult and it requires code.
- The best example of an advanced multi-select window is the Tree Maintenance form
- To see how this window is created:
- Log in as System Admin
- Open the Menu window
- Find the 'Tree Maintenance' window
- Zoom to the Special Form
- Notice that the form points to VTreeMaintenance
- Note: iDempiere has a legacy UI called swing. The VTreeMaintenance is dedicated to swing. The system knows how you are accessing iDempiere and if it determines you are using a web interface, it will load WTreeMaintenance instead.
- Review the WTreeMaintenance class to see how the form is created.