I am presently experimenting with dhtmlxConnector for ColdFusion. I was able to build a simple grid and connect that to a database, but now I want to set a filter condition on the ID column, which does not seem to be possible.
The filter is set on the client side according to the documentation “URL manipulation” with the following code:
grid.load("cf_ifx_gridconnector.cfm?connector=true&dhx_filter[0]=12071000");
which filters on the first data column specified in the connector. To make the filter work, I have to include the ID in the list of data columns, which I want to avoid to prevent the user from editing the ID. So how can I set a filter condition on the ID column and not a data column?
The next problem is that the above filter results in a wildcard search
WHERE <filtered column> LIKE '%12071000%'
which unnecessarily reduces performance. How can I force an exact search
WHERE <filtered column> = '12071000'
in the ColdFusion connector? I found examples for PHP and .NET in this forum, but not for CF.
Through the thread Passing Parameters I found out that it is possible to directly pass URL parameters to the connector, so I changed the connector code from “render_table” to “render_sql” with the search condition passed in the URL of the call to the connector.
This is the call to the connector:
grid.load("cf_ifx_gridconnector.cfm?andoknr=<cfoutput>#A_NR#</cfoutput>");
and this is the code in the connector:
<cfset grid.render_sql("SELECT klinikum, bereich, klinik, apn FROM andok99 WHERE andoknr = '#URL.andoknr#'","andoknr","klinikum, bereich, klinik, apn")>
This displays the row correctly in the grid. However, I cannot update row data. This is the coldfusion error I get when trying to edit data through the grid:
Element ANDOKNR is undefined in URL.
It seems that the connector is called again through the built-in update mechanism, this time without the URL parameter. So is custom update code the only option I have?