I have a grid that loads contact data for the selected record, but when I try to use render_sql it fails.
my connector code is as follows:
require_once("config.php");
$res=mysql_connect($mysql_server,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);
require("dhtmlx/connector/grid_connector.php");
$grid = new GridConnector($res);
$config = new GridConfiguration();
$config->setHeader("ID,First Name,Last Name,Title,Office,Extn,Mobile,Email");
$config->setColTypes("ro,ed,ed,ed,ed,ed,ed,ed");
$grid->set_config($config);
$grid->enable_log("temp.log",true);
$grid->dynamic_loading(10);
if ($grid->is_select_mode()){//code for loading data
$grid->render_sql("Select * from vendor_registration_contact WHERE VEND_REG_ID=".$SelectID, "VEND_CONT_ID","VEND_REG_ID, VEND_FNAME, VEND_LNAME,VEND_TITLE,VEND_PHONE,VEND_EXTN,VEND_MOBILE,VEND_EMAIL1");
}else {//code for other operations - i.e. update/insert/delete
$grid->render_table("vendor_registration_contact","VEND_CONT_ID","VEND_REG_ID, VEND_FNAME,VEND_LNAME,VEND_TITLE,VEND_PHONE,VEND_EXTN,VEND_MOBILE,VEND_EMAIL1");
}
If I uses render_table, the grid loads just fine, but it fails with render sql.
I checked the XML returned and for render_table it is as follows:
<?xml version="1.0" encoding="utf-8" ?>
- <rows total_count="13">
- <head>
<column type="ro" width="100">ID</column>
<column type="ed" width="100">First Name</column>
<column type="ed" width="100">Last Name</column>
<column type="ed" width="100">Title</column>
<column type="ed" width="100">Office</column>
<column type="ed" width="100">Extn</column>
<column type="ed" width="100">Mobile</column>
<column type="ed" width="100">Email</column>
- <settings>
<colwidth>px</colwidth>
</settings>
</head>
- <row id="20">
- <cell>
- <![CDATA[ 10
]]>
</cell>
- <cell>
- <![CDATA[ #######
]]>
</cell>
- <cell>
- <![CDATA[ unknown
]]>
</cell>
- <cell>
- <![CDATA[ Business Development
]]>
</cell>
- <cell>
- <![CDATA[
]]>
</cell>
- <cell>
- <![CDATA[
]]>
</cell>
- <cell>
- <![CDATA[
]]>
</cell>
- <cell>
- <![CDATA[
]]>
</cell>
</row>
</rows>[/code]
and for render_sql it is as follows. The header is dropped:
[code] <?xml version="1.0" encoding="utf-8" ?>
- <rows total_count="1">
- <row id="28">
- <cell>
- <![CDATA[ 1
]]>
</cell>
- <cell>
- <![CDATA[ #######
]]>
</cell>
- <cell>
- <![CDATA[ #######
]]>
</cell>
- <cell>
- <![CDATA[ Program Manager
]]>
</cell>
- <cell>
- <![CDATA[
]]>
</cell>
- <cell>
- <![CDATA[
]]>
</cell>
- <cell>
- <![CDATA[ #######
]]>
</cell>
- <cell>
- <![CDATA[ #######@#######.com
]]>
</cell>
</row>
</rows>[/code]
IE displays the following javascript error.
[code]Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; .NET4.0C; Tablet PC 2.0)
Timestamp: Mon, 22 Nov 2010 18:41:41 UTC
Message: 'this.obj.firstChild' is null or not an object
Line: 804
Char: 45
Code: 0
URI: http://domain.com/vreg/dhtmlx/dhtmlx.js
I am just stumpped, need some help