Kick starting the code
- Locate the init() function in the DBExplorer.js file. Add an event
handler for the load data source button by inserting the following
code into the script at the lines indicated.
This tells the browser to execute this function when the button is clicked. We could have added these event listeners directly inside the form input tags, but that is not near as much fun. When adding event listeners using this method, you add the actual function object, and therefore, do not include quotes or the parenthesis. The events for the other fields have already been coded for you. The table below contains the other "onXXX" events that are already coded and need no action by you. You can review these areas of the code if you wish to have a better understanding.
Input field Event Handler function Action performed Data source load button onclick event_setDataSource Retrieves database properties and schema list. Schema select onchange event_setSchema Retrieves the table list. Table select onchange event_setTable Retrieves available columns. Available columns select ondblclick event_addColumn Adds column to active columns list and retrieves table data. Active columns select ondblclick event_deleteColumn Removes column from active columns list and retrieves table data.
- Save your changes before continuing to the next step by selecting File -> Save from the menu or type Ctrl-S.