Adding generic objects to a table
The rows of a table column are obtained by getting an attribute from the item representing the row of the table. The attribute class can be a String or any other object. If the attribute class is not a string, then the following methods are used to find the value to use in the table:
abtGenerateHtmlIntoTable: aTable column: aTableColumn rowNumber: anInteger
abtGenerateHtml
printString
These methods should answer a data value or HTML value which is placed in the table at the row and column where the object is found.
If the attribute is a subclass of AbtHtmlPart, for example, AbtHtmlEntryField, then the proper methods will have already been implemented so that they render properly. This allows you to create a table where one column is entry fields. So, for example, an attribute can answer an entry field using the code:
^AbtHtmlEntryField new
string: (self initialValueString);
yourself.
To get the form data from a column of entry fields, the attribute #containsFormElements should be set to true. In this case, the form data for the column will appear as an attribute of the FormData part as the connection columnNameFormDataDictionary where the columnName is the part name of the column. This FormData property is a dictionary of input from the column, where the key is a integer index of the row which contained the data, and value is the String value specified in that row.
This processing is shown in the application AbtWebSampleCatalogApp where class AbtWebSampleCatalogItem has an attribute quantityOrderedEntryField that answers an instance of an entry field. The part AbtWebSampleEntryFieldCatalogPage has a column ("Order") in the first table which uses these entry fields. The FormData property for this column is processed in the page by the getOrderItemsFromFormDictionary:queryResult:currentOrder: script. Note in order to match the integer index value from the form data to an actual table item, the collection of items represented in the table are stored in a session data part. In this way, the query does not have to be repeated.
Using this approach, complex tables of form elements can be built.
Last modified date: 01/29/2015