Issue with xml generated in firefox

Hi Guys,

I noticed an issue after I used Data connector to generate xml for the grid in Firefox.
This does not affect IE or chrome. The grid does not seem to display any values in Firefox.

The below is the Data Connector Server Side Code

class DataValueModel{
    protected $dataFields = " ";
    protected $selTagId = 0;
    public function __construct($dataF,$tagId)
        $this->dataFields = $dataF;
        $this->selTagId = $tagId;
    function get($request){
        global $db;
        $data = array();
        $result = $db->query(sprintf('
        SELECT id,field_id,name
        FROM data_values
        WHERE field_id IN (%s)
        AND active = 1
        ORDER BY `index`, name
        while ($row = $result->fetch_assoc()) { //filter user selected tags
            $data[] =  array("id"=> $row['id'], "name" =>$row['name']);
        return $data;    
    function update($action){
    function insert($action){
        //call $action->success(); or $action->invalid(); 
    function delete($action){

The client side code is :

        var dp = new dataProcessor("/app/ajax_datavalues/<?=$account->id?>");  
        dp.action_param = "dhx_editor_status";
        dvgrid = dvLayout.cells("a").attachGrid();
        //dvgrid = new dhtmlXGridObject('gridbox');
	dvgrid.setHeader("Id, Data Value");
	dvgrid.enableMultiselect(true); //for deleting multiple rows
        dvgrid.setUserData("", "fieldId", $("#datafield").val());
        dvgrid.attachEvent("onXLS", function(grid_obj){ //shows laoding data message
        dvgrid.attachEvent("onXLE", function(grid_obj,count){

	dvgrid.load("/app/ajax_datavalues/<?=$account->id?>/<?=$selTagId ?>",function(){ $("#loadblock").hide(); });
	dp.attachEvent("onAfterUpdate", function(sid, action, tid, xml){
		if (action == "invalid"){
			dvgrid.setCellTextStyle(sid, 1, "background:#eeaaaa");
		} else dvgrid.clearAndLoad("/app/ajax_datavalues/<?=$account->id?>/" + $("#datafield").val());


And the connector code used is the following

$data = array();
foreach ($account->dataFields as $datakey => $dfv){
	if($selTagId != -1 && $datakey != $selTagId) continue;
                $data[] = $datakey; //contains only selected data key
$mysqli = new Db;
$conn = new GridConnector($mysqli, "MySQLi"); 
$conn->configure("dummy", "id", "id, name");
$conn->useModel(new DataValueModel(join(",",$data),$selTagId));

I am using the dhtmlx connector from github that you had recently posted and when I was not using connector (directly generating xml it seemed to work in firefox). But the code works perfectly in Chrome and IE 11. The FF version says 35.0.1
Any help would be greatly appreciated. Thank you for the great framework.

Output has a newline before <?xml tag. Unfortunately that is enough to break data parsing in the firefox.

Please check the php script that init connector. This file ( or some of its includes ) has the problematic empty line ( most probably a new line after closing php tag ) which corrupts the export.

( if you have buffered output enabled in the php settings then connector will fix this problem automatically )

Hi Stanislav,

Thank you very much. Indeed, it was a blank line in the DataViewmodel class itself :smiley:
Brilliant suggestion and a good eye !