In addition to Abbottmw's jsStringFormat
suggestion, notice he wrapped the ColdFusion output in quotes which are required but missing from your code.
If the XML isn't working out for you, you could probably load it using JSON created with ColdFusion's SerializeJSON
or use a CFC with the function's returnformat="JSON"
and this JSON
spec in DHTMLX or load from an array
using toScript
from ColdFusion.
However, is there a way to take the query results and pass them directly to dhtmlxGrid directly without having to write the data to a file and then reading it?
Definitely. From the JSON loading instructions:
To load data from a remote file (a static JSON file or any kind of script that will generate json output) the following code strings should be used:
That means something as simple a .cfm or .cfc (recommended) page that generates the json output dynamically. For example, If you used a CFC with a function called dhtmlxJSON, you would call it like this in your grid. grid.load("myJsonGenerator.cfc?method=dhtmlxJSON","json");