How to use the JSListPicker

NOTE: this applies to version 1.0

Example

The minimum settings you need to use are the following:

// Get an instance of the JSListPicker
var _oLP = globals.LISTPICKER.createPicker(),
    _oCL;

// The datasource of the form and what column we need to return
_oLP.form.server = "user_data";
_oLP.form.table = "people";
_oLP.form.pickColumn = "zzid_people";

// How are we gonna return the picked value
_oLP.callback.formName = "myUniqueFormName";
_oLP.callback.dataprovider = "myFormVariable"; // can be a variable or a columnName

// What columns are we gonna show, at least 1 column is required
_oCL = _oLP.newColumn();
_oCL.dataprovider = "name_first";
_oCL.titleText = "First Name";

// On what columns are we gonna search. at least 1 column is required
_oCL = _oLP.newSearchColumn();
_oCL.dataprovider = "name_first";

// Now show the listpicker window
_oLP.show()

Available properties and functions

Some of the properties are required but have a default value and therefor don't need to be set when you don't want to change the default.

The following functions are available:

newColumn()

This adds and returns a JSLP_Column object with the following properties

Property Required value Default value Remarks
dataprovider Yes
displayType Yes TEXT_FIELD
titleText
tooltipText
width Yes -1 -1 means that the fields with -1 width will be spread equally
format
editable Yes false
valuelist
margin
horizontalAlignment SM_ALIGNMENT.LEFT Uses the values of SM_ALIGNMENT.*

newSearchColumn()

This adds and returns a JSLP_SearchColumn object with the following properties

Property Required value Default value Remarks
dataprovider Yes
method You can provide a method to do the searching on this column.
This might be needed when you use columnconverters.

getAllSearchColumns()

This returns an array with the available searchcolumn objects.

newFilterParam()

This adds and returns a JSLP_FilterParam object with the following properties

Property Required value Default value Remarks
dataprovider Yes
operator Yes =
value Yes "" Can hold any value except null

getAllFilterParams()

This returns an array with the available searchcolumn objects.

Directly accessible properties

Property Required value Default value Remarks
form.name Yes mod_listpicker_form
form.server Yes Unless dataSource is used
form.table Yes Unless dataSource is used
form.dataSource Yes Unless server/table is used
form.width Yes 600
form.height Yes 500
form.title
form.stylesheet
form.rowHeight Yes 20
form.pickColumn Yes
form.searchMethod Allows an override of the built in search by your own method
form.loadAllRecords false
form.multiselect false
form.sort Uses the same (string) syntax as foundset.sort/controller.sort
form.allowHeaderSort false Enables/disables sorting by clicking on the table headers
form.sortMethod method for overriding the default header sort behavior
form.selectedDataset read-only. Is filled with the selected PK's when multiselect is enabled
rowbgcolor.even #EDF3FE
rowbgcolor.odd #FFFFFF
rowbgcolor.select #C6CDD7
callback.formName Yes unless method is used
callback.dataprovider Yes unless method is used
callback.method Yes unless formName and dataproviderName is used
callback.createNewMethod
callback.closeAfterNew true
buttontext.cancel Yes Cancel
buttontext.createNew Yes Create New This button can have any function, not only create new
buttontext.ok Yes OK
typeahead.enabled Requires KeyListener plugin
typeahead.minimumCharacters 2 Requires KeyListener plugin