Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by nicolas mathieu on Jan 14, 2010 00:36
open dhtmlx forum
beforeupdate connector grid

Hello,
I'm using dhtmlxgrid ( dhtmlxSuite 2009 Rel.2 (DHTMLX 2.5) Professional edition build 91111 ) with connector (dhtmlxConnector for PHP v.0.96 ) and i can't update one column.


this is my code:

    var dhxGridStudy = dhxLayout.cells("a").attachGrid();
    dhxGridStudy.setImagePath("./dhtmlxSuite/dhtmlxGrid/codebase/imgs/");
    dhxGridStudy.setSkin("dhx_black");
    dhxGridStudy.init();
    dhxGridStudy.enableSmartRendering(true);
    dhxGridStudy.loadXML("php/getstudies_connector.php",function(){
        dhxGridStudy.setSelectedRow(1);
         doOnRowSelectStudy(1,0);
         });

    myDataProcessor=new dataProcessor("php/getstudies_connector.php");
    myDataProcessor.enableDebug(true);
    myDataProcessor.enableDataNames(true);
    myDataProcessor.setTransactionMode("GET");
    myDataProcessor.init(dhxGridStudy);

////////////////////////
and for 'getstudies_connector.php':

    require_once("../dhtmlxSuite/dhtmlxConnector_php/codebase/grid_connector.php");

    // Fichiers Include
    include ("connexion.php");    


    $gridConn = new GridConnector($resultConnection,"MySQL");
    //$gridConn->set_encoding("iso-8859-1");
    $gridConn->dynamic_loading(40);
    $gridConn->enable_log("some.txt");

    $gridConn->event->attach("beforeOutput","grid_header");
    $gridConn->event->attach("beforeUpdate","doBeforeUpdate");
    
    $gridConn->render_sql("SELECT study.ID as SID, StudyDescription, date_format(StudyDate,'%d/%m/%Y') as sd, Modality as moda,ReferringPhysiciansName, NameOfPhysiciansReadingStudy,AccessionNumber, IDPatient, PatientID, PatientsName, PatientsSex, date_format(PatientsBirthDate,'%d/%m/%Y') as pbd, ReferencedStudySequence, RTFReportPath FROM study INNER JOIN patient ON (study.IDPatient = patient.ID)","","IDPatient,ReferencedStudySequence,ImagePGEType,PatientID,PatientsName,PatientsSex,pbd,SID,StudyDescription,sd,moda,nbSer,nbImg,ReferringPhysiciansName,NameOfPhysiciansReadingStudy,AccessionNumber","","");

    function doBeforeUpdate($action){
     $id = $action->get_value("sid");
     $data = $action->get_value("ReferencedStudySequence");
     mysql_query("update study set ReferencedStudySequence='".$data."' where study.ID='".$id."'");
        $action->success();
    }

////////////////////////
Here my différents logs:
some.txt:
====================================
Log started, 14/01/2010 09:01:10
====================================

SELECT study.ID as SID, StudyDescription, date_format(StudyDate,'%d/%m/%Y') as sd, Modality as moda,ReferringPhysiciansName, NameOfPhysiciansReadingStudy,AccessionNumber, IDPatient, PatientID, PatientsName, PatientsSex, date_format(PatientsBirthDate,'%d/%m/%Y') as pbd, ReferencedStudySequence, RTFReportPath FROM study INNER JOIN patient ON (study.IDPatient = patient.ID) LIMIT 0,40

SELECT COUNT(*) as DHX_COUNT FROM study INNER JOIN patient ON (study.IDPatient = patient.ID)

Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\php\getstudies_connector.php:4) at C:\xampp\htdocs\dhtmlxSuite\dhtmlxConnector_php\codebase\base_connector.php line 428

Done in 6.7949199676514s



====================================
Log started, 14/01/2010 09:01:19
====================================

DataProcessor object initialized
1263457871_1_gr_id => 1263457871_1
1263457871_1_IDPatient => 43
1263457871_1_ReferencedStudySequence => 1
1263457871_1_ImagePGEType => http://localhost/res/imgs/report_dis.gif
1263457871_1_PatientID => 012345678
1263457871_1_PatientsName =>
1263457871_1_PatientsSex => f
1263457871_1_pdb => 11/00/2020
1263457871_1_SID => 52
1263457871_1_StudyDescription =>
1263457871_1_sd =>
1263457871_1_moda => CR
1263457871_1_nbSer => 1
1263457871_1_nbImg => 1
1263457871_1_ReferringPhysiciansName =>
1263457871_1_NameOfPhysiciansReadingStudy =>
1263457871_1_AccessionNumber => 1234
1263457871_1_!nativeeditor_status => updated
ids => 1263457871_1

Row data [1263457871_1]

Incorrect field name used: sid

data

Incorrect field name used: ReferencedStudySequence

data

Event code for update processed

Edit operation finished
0 => action:updated; sid:1263457871_1; tid:1263457871_1;

Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\php\getstudies_connector.php:4) at C:\xampp\htdocs\dhtmlxSuite\dhtmlxConnector_php\codebase\dataprocessor.php line 206

Done in 0.0035309791564941s

and dataprocessor debug:
Log:
row 1263457871_1 marked [updated,valid]
Initiating data sending for 1263457871_1
Initiating data sending for all rows
Sending all data at once
Server url: php/getstudies_connector.php?editing=true parameters

1263457871_1_gr_id=1263457871_1
1263457871_1_IDPatient=43
1263457871_1_ReferencedStudySequence=1
1263457871_1_ImagePGEType=http%3A%2F%2Flocalhost%2Fres%2Fimgs%2Freport_dis.gif
1263457871_1_PatientID=012345678
1263457871_1_PatientsName=
1263457871_1_PatientsSex=f
1263457871_1_pdb=11%2F00%2F2020
1263457871_1_SID=52
1263457871_1_StudyDescription=
1263457871_1_sd=
1263457871_1_moda=CR
1263457871_1_nbSer=1
1263457871_1_nbImg=1
1263457871_1_ReferringPhysiciansName=
1263457871_1_NameOfPhysiciansReadingStudy=
1263457871_1_AccessionNumber=1234
1263457871_1_!nativeeditor_status=updated
ids=1263457871_1

Server response received details

<?xml version="1.0" encoding="iso-8859-1"?> <?xml version='1.0' ?><data><action type='updated' sid='1263457871_1' tid='1263457871_1' ></action></data>

Why i get "Incorrect field name used: sid" and "Incorrect field name used: ReferencedStudySequence".


thanks for your help!
N. MATHIEU
Answer posted by Stanislav (support) on Jan 14, 2010 02:51
>>Cannot modify header information - headers already sent by
Please check  getstudies_connector.php - this file most probably have some whitespaces before <php tag, or outputs data in some other way.
This may break response parsing in FireFox

To fix the issue , you need to add some ID field in config

  $gridConn->render_sql("SELECT study.ID as SID, StudyDescription, date_format(StudyDate,'%d/%m/%Y') as sd, Modality as moda,ReferringPhysiciansName, NameOfPhysiciansReadingStudy,AccessionNumber, IDPatient, PatientID, PatientsName, PatientsSex, date_format(PatientsBirthDate,'%d/%m/%Y') as pbd, ReferencedStudySequence, RTFReportPath FROM study INNER JOIN patient ON (study.IDPatient = patient.ID)","SID","IDPatient,ReferencedStudySequence,ImagePGEType...
Answer posted by nicolas MATHIEU on Jan 14, 2010 04:32
thanks a lot for your quick answer,

now it's working.
There was a white space on top of my 'php/getstudies_connector.php'.