Tuesday, September 25, 2012

Adding a Drop Down List (ComboBox).

Hi All,

Reason for publishing this article - lack of documentation on this type of control in standard user guides for customization module. Control is handy, therefore should compensate.

There is a field type called Drop Down List or Combo Box in old notation, very useful when we have limited number of choices and they are predefined. Examples of Drop Down Lists:

Module Field in Journal transactions screen from GL module:

Billing Option from AR Invoice screen, here we have this control on the grid:

In order to add this type of control on the screen we should open Customization, Design Mode for the screen. I will demonstrate based on Subaccount Maintenance screen, where I like to add Area code as a combo box.
 
Then I switch to design mode and went to Control Tree:
 
Here I click Add->Add Column to Grid then Add for new field:
 
 Right after that, we need to add a field to database as well. I will call it Area, let it be 2 characters long:
 
At the final screen I state the control type, which is ComboBox:
 
 Now control is added, but we still need to add a list of values for the drop down.
I wish it to be 01 to 10 with descriptions Zone One to Zone Ten. I first click apply then go to Attributes:
 
 
 The string to add should be:
[PXStringList(new string[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10" }, new string[] { "Zone One", "Zone Two","Zone Three", "Zone Four","Zone Five", "Zone Six","Zone Seven", "Zone Eight","Zone Nine", "Zone Ten" })]
 
Where first comes list of DB values :) you guys know what it is, right :) Secondly the list of displayed labels.
 
Then click Ok->Apply->Save
 
Now save the customization and publish it.
 
Please note, that due to specific of adding new fields to database you have to restart the whole ISS in order to make those fields appear and attributes to work correctly.
 
So lets restart the server then it will be seen.
 
All the Best,
 
Sergey.

No comments:

Post a Comment