populate header from DB table

Hi,
I have a database table with all the column names I want in my grid. What is the best way to set the header from this data?
Should I modify the URL passed into mygrid.load to construct JSON format to include head []?
Thanks

You may init the grid header from the xml:
docs.dhtmlx.com/grid__xml_configuration.html
or from the json:
docs.dhtmlx.com/grid__json_configuration.html

Im actually using the nodejs example you guys provided to try this out.

Looking at the document, it seems grid initialize will take either native json or basic jason format. In the nodejs example, the mysql query returns data in native json format. When using native json, the documentation mentions that setColumnIds must be used. If my header is loaded from a table and it can change depending on whats in there, how does one set columnIds dynamically? Is there a way to convert native json format to basic format?

If the header of your grid is defined right in JSON there is no need to use the setColumnIds method on client-side as you may assign the id right in the json:
{
head:[
{id:“sales”, width:50, type:“dyn”, align:“right”, sort:“int”, value:“Sales”},
{id:“title”, width:150, type:“ed”, align:“left”, sort:“str”, value:“Book Title”},
{id:“author”, width:100, type:“ed”, align:“left”, sort:“str”, value:“Author”},
{id:“price”, width:80, type:“price”, align:“right”, sort:“str”, value:“Price”},
{id:“instore”, width:80, type:“ch”, align:“center”, sort:“str”, value:“In Store”},
{id:“shipping”, width:80, type:“co”, align:“left”, sort:“str”, value:“Shipping”}
],
data:[