Using the RFA Data Picker
7 March 2008So far we have introduced the standard, reusable data picker, built an abstract Java class upon which we can build servlets to feed it data, and then extended that class with an implementing servlet to serve up our Request for Approval data. Now if we want to create a data picker that uses our new servlet, we just need to add a little Javascript code to configure the front end:
// rfaselect.js
/**
* This function sets up the pop-up selection window scripts
*/
function standardSetUp() {
fieldName = [
'id',
'type',
'state',
'payloadId',
'payloadURI',
'description',
'authorId',
'authorURI',
'authorName',
'dateTime'];
fieldIndex = {
'id': 0,
'type': 1,
'state': 2,
'payloadId': 3,
'payloadURI': 4,
'description': 5,
'authorId': 6,
'authorURI': 7,
'authorName': 8,
'dateTime': 9};
fieldLabel = [
'ID',
'Type',
'State',
'',
'',
'Description',
'',
'',
'Author',
''];
titleText = 'Request for Approval Selection';
baseXmlUrl = '/approval/rfa.xml';
document.getElementById("containscol").style.visibility = 'visible';
document.getElementById("containscol").style.display = '';
startsWith = '';
defaultStartsWith = '';
}
That’s all there is to it. Once you have all of the foundation components in place, setting up a new data picker is just a matter of extending the base servlet class on the back end, and then setting up the configuration script on the front end. Other than those two implementation-specific pieces, the rest of the system is all pre-existing, reusable components.
Oh, and if you want to test it out without going to the trouble of setting up a page to pop up your new data picker window, you can just enter the appropriate URL right into the address bar of your local browser. The base script is smart enough to know that there is no parent window to whom it should send the item selected, so when you click on something, it just shows you the item that you have chosen. You can see that in action here.
Sorry, the comment form is closed at this time.





