Configuring your own data picker
2 March 2008Setting up your own data picker is as simple as creating your own configuration Javascript file and providing a corresponding XML data source. A data picker configuration script contains a single function, standardSetUp, which sets the value of a number of variables used by the pop-up selection window:
- fieldName – this is an array of field names corresponding to the data provided by your XML data source, and will become the properties of the object that will be passed back to using pages once a selection is made.
- fieldIndex – this is a rather pointless requirement that could be easily generated from the fieldName array, but in the current version, you need to provide a map keyed by field name that stores the index value for each field in the field name array.
- fieldLabel – this is the column heading label that will appear above the column for each field; if you set this value to a blank string (“”), that field will not be displayed, but it’s value will still be returned in the object passed back to the using page.
- titleText – this is the title for the pop-up screen.
- baseXmlUrl – this is the relative URL to the data in XML format.
- startsWith – the initial value for the “starts with” search
- defaultStartsWith – the default value for the “starts with” search to be used in lieu of a blank search (all data).
Also, the default configuration of the data picker is to provide the “Starts with” search option, but to hide the “Contains” option. If you want your picker to include the “contains” search, you need to reveal that section of the screen with the following code:
document.getElementById("containscol").style.visibility = 'visible';
document.getElementById("containscol").style.display = '';
An example of a working configuration script can be found with the demo page artifacts in the file cyselect.js.
By convention, calling the pop-up window with the query string parameter “id” set to some value (such as “cy”) will cause the page to attempt to load a script named “<id-value>select.js”. Alternatively, you can pass the query string parameter “js” set to the full URL of your configuration script.
Sorry, the comment form is closed at this time.





