Показать сообщение отдельно
Старый 06.03.2007, 00:33   #1  
Blog bot is offline
Blog bot
Участник
 
25,477 / 846 (79) +++++++
Регистрация: 28.10.2006
axaptapedia: Tutorial Form MultiSelectCheckBox
Источник: http://www.axaptapedia.com/Tutorial_...SelectCheckBox
==============

Summary: see also + category
== A tutorial about MultiSelect with CheckBox in a form ==

[http://www.axaptapedia.com/images/4/...ctCheckBox.xpo download xpo]

=== Preview ===
[[Image:Screen.PNG]]

=== Description ===
Sometimes, simply selecting the lines you want in a datasource and pressing OK (or other button) is not enough for the users.
They want to clearly see what they have selected, be able to easily modify the selecting, and to their liking whould be to see a checkbox on the left of the grid for each line.
(For an example, see CustTransOpen form where you mark transaction with a checkbox)

Here is a simple tutorial form based on InventTable datasource.
You can select multiple lines and process the lines by pressing ''Process lines'' button.


The code in the form is commented. So it will be easy for anyone to understand the way it works
Here is the extract of the comments I think you should definitely read: (ClassDeclaration)
1. A set of strings is used in the example, because ItemId is a primaryKey field
2. Easiest is to use a RecId set, but in this case you have to create a RecId index on the table (see prop. CreateRecIdIndex) to speed up processing of selected lines
3. Notice that AllowEdit is enabled on the DataSource, but prohibited on all the fields. This is to allow editing of the edit-method.

And: (in the ProcessLines method on the form)
This method should not be implemented on the form and is merely here to avoid creating another object for the example
The processing should be implemented on a server based class
To pass the selected lines to the class for processing use the pack method of the set object, itemIdSet.pack()
This will create a container that you will pass on to the class. Then you unpack the container into a Set object
Set processLinesSet = Set::create(_packedSet), where _packedSet is the passed container

=== See also ===
[[Multiple_grid_selections]]

[[Category:Form development]]


Источник: http://www.axaptapedia.com/Tutorial_...SelectCheckBox
За это сообщение автора поблагодарили: alex55 (1).