Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Taso on Sep 15, 2009 10:31
open dhtmlx forum
Auto generation of column headers

Hello,

Wondering if there is a way to auto-generate the column headers for dhtmlxGrid. From what I have seen thus far I would have to write my own db connector in php and output the appropriate xml, which is fine, but I wonder if I have missed some built in functionality.

Taso
Answer posted by dhxSupport on Sep 16, 2009 05:04
You can set grid configuration via xml with <head> part. Please find more information here http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxgrid:configuration_from_xml
If you are using connectors to populate your grid you can use "beforeOutput" connector's event. Please find more information here http://dhtmlx.com/dhxdocs/doku.php?id=dhtmlxconnector:event_beforeoutput
Answer posted by Taso on Sep 22, 2009 13:53
Hi,

Neither generating my own xml or using beforeOutput are really useful. In the end I am looking for a mechanism to provide inputs of 'table', 'list of fields' and output a grid automatically. I can guess at the column types based on the database datatypes (date, text, integer, etc.) but for now it looks like my options are:

1) Create my own php connector that does the above work. That eliminates all the useful functionality in the connector codebase, so it is not preferred.

2) Manually define the grid column headers, which is not useful for what I am trying to achieve.

If I use 'beforeOutput' the function I call can not accept any arguments, therefore is not dynamic as I require. If I create my own xml I lose functionality, which is undesirable. I suppose that after looking at the code on and off for a few days I am really impressed with your work, and figure you guys are smart enough to suggest a working solution. I would rather not hack the source since the maintenance after upgrades would be painful. Just trying to find a working alternative that does 'render_table_with_headers("<tablename>","column1(First Field),column2(Second Field),column3(Third Field)")'. Any suggestions?