Initializing ColdFusion Connector

To use the functionality of DHTMLX Connector, first you should initialize it.

Generally, both client- and server-sides are concerned in it.

Client side

If you need just load data from database (with or without data preprocessing)

1) Specify connector file in the load method of a component.

//index.html
myGrid = new dhtmlXGridObject("someContainer");// initializes grid
...
mygrid.load("myconnector.cfm");

If you need to perform any update operations

1) Specify connector file in the load method of a component.

2) Initialize dhtmlxDataProcessor on the client side (read more about it here).

//index.html
myGrid = new dhtmlXGridObject("someContainer");// initializes grid
...
myGrid.load("my_connector.php");
myDP = new dataProcessor("myconnector.cfm");// initializes dhtmlxDataProcessor
myDP.init(myGrid);

Samples Client-Side Initialization

Server side

In our examples we use mapping “dhtmlXConnectors” which links to the folder with cfc files.

Preparations:

  1. Create datasource in CF Admin (further, we will use “datasource” variable for this).
  2. Put connectors into the folder that can be achieved by your custom cf templates.

Main steps:

  1. Include the appropriate connector file into the page.
  2. Instantiate the connector object. Linking variable is a mandatory parameter in all constructors. The second parameter(database type) is optional. By default it's “MySQL”.
  3. The last step is data configuration.
<cfinclude template="../config.cfm">// connector file
<cfset grid = createObject("component","dhtmlxConnectors.GridConnector").init(
    "#datasource#","MySQL")> 
<cfset grid.render_table("mytable","item_id","item_nm,item_cd")>
Back to top