< Day Day Up > |
The functions in the Data Sources API let you find, add, edit, and delete data sources and also generate and inspect dynamic data objects. addDynamicSource()Availability Dreamweaver UltraDev 1. Description This function adds a dynamic data source. Because there is one implementation of this function in each data source file, Dreamweaver calls the appropriate implementation of the addDynamicSource() function when you select a data source from the Plus (+) menu. For example, for recordsets or commands, Dreamweaver calls the dw.serverBehaviorInspector.popupServerBehavior() function, which inserts a new server behavior into the document. For request, session, and application variables, Dreamweaver displays an HTML/JavaScript dialog box to collect the name of the variable; the behavior stores the variable name for future use. After the addDynamicSource() function returns, Dreamweaver erases the contents of the data source tree and calls the findDynamicSources() and generateDynamicSourceBindings() functions to repopulate the data source tree. Returns Dreamweaver expects nothing. deleteDynamicSource()Availability Dreamweaver UltraDev 1. Description Dreamweaver calls this function when a user selects a data source in the tree and clicks the Minus (-) button. For example, in Dreamweaver, if the selection is a recordset or command, the deleteDynamicSource() function calls the dw.serverBehaviorInspector.deleteServerBehavior() function. If the selection is a request, session, or application variable, the function remembers that the variable was deleted and does not continue to display it. After the deleteDynamicSource() function returns, Dreamweaver erases the contents of the data source tree and calls the findDynamicSources() and generateDynamicSourceBindings() functions to get a new list of all the data sources for the user's document. Arguments sourceName, bindingName
Returns Dreamweaver expects nothing. displayHelp()Description If this function is defined, a Help button appears below the OK and Cancel buttons in the dialog box. This function is called when the user clicks the Help button. Arguments None. Returns Dreamweaver expects nothing. Example // The following instance of displayHelp() opens // a file (in a browser) that explains how to use // the extension. function displayHelp(){ var myHelpFile = dw.getConfigurationPath() + '/ExtensionsHelp/superDuperHelp.htm'; dw.browseDocument(myHelpFile); } editDynamicSource()Availability Dreamweaver MX. Description This function is called when the user double-clicks a data source name in the Bindings panel to edit the data source. You can implement this function to handle user edits in the tree. Otherwise, the server behavior that matches the data source is automatically invoked. The extension developer can use this function to override the default implementation of server behaviors and provide a custom handler. Arguments sourceName, bindingName
Returns Dreamweaver expects a Boolean value: TRue if the function has handled the edit; false otherwise. findDynamicSources()Availability Dreamweaver UltraDev 1. Description This function returns the top-level nodes from the data source tree that appears in the Dynamic Data or Dynamic Text dialog box or in the Bindings panel. Each data source file has an implementation of the findDynamicSources() function. When Dreamweaver refreshes the tree, Dreamweaver reads through all the files in the DataSources folder and calls the findDynamicSources() function in each file. Returns Dreamweaver expects an array of JavaScript objects where each object can have as many as five properties, which are described in the following list:
NOTE A JavaScript class that defines these properties exists in the DataSourceClass.js file, which is located in the Configuration/Shared/Common/Scripts folder. generateDynamicDataRef()Availability Dreamweaver UltraDev 1. Description This function generates the dynamic data object for a child node. Arguments sourceName, bindingName
Returns Dreamweaver expects a string, which can be passed to the formatDynamicDataRef() function to format it before inserting it in a user's document. generateDynamicSourceBindings()Availability Dreamweaver UltraDev 1. Description This function returns the children of a top-level node. Arguments sourceName
Returns Dreamweaver expects an array of JavaScript objects where each object can have as many as four properties, which are described in the following list:
NOTE A JavaScript class that defines these properties exists in the DataSourceClass.js file, which is located in the Configuration/Shared/Common/Scripts folder. inspectDynamicDataRef()Availability Dreamweaver UltraDev 1. Description This function determines the corresponding node in the data source tree from a dynamic data object. The inspectDynamicDataRef() function takes the string that Dreamweaver passes in and compares it to the string that generateDynamicDataRef() returns for each node in the tree. If a match is found, the inspectDynamicDataRef() function indicates which node in the tree matches the passed-in string. The function identifies the node by using an array that contains two elements. The first element is the name of the parent node, and the second element is the name of the child node. If no match is found, the inspectDynamicDataRef() function returns an empty array. Each implementation of the inspectDynamicDataRef() function checks only for matches of its own object type. For example, the recordset implementation of the inspectDynamicDataRef() function finds a match only if the passed-in string matches a recordset node in the tree. Arguments string
Returns Dreamweaver expects an array of two elements (parent name and child name) for the matched node; it returns a null value if no matches are found. |
< Day Day Up > |