Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jorge on Oct 03, 2009 21:33
open dhtmlx forum
mygrid.attachEvent

I have 3 grids in same form but grids that it has defined the attachEvents appears empty. Grids is loaded through XML and verifying the content of the XML this it is generated, I tried clearing the sentences of attachEvents and grids load perfectly, what can be my problem? , associate the code that I am using: Grid 1 and 3 perfect Grid 2 problems.

Grid 1

    $dhtmlx='<script type="text/javascript">'.chr(13);
    $dhtmlx.="mygrid = new dhtmlXGridObject('gridbox1');".chr(13);
    $dhtmlx.='mygrid.setImagePath("../../html/default/images/");'.chr(13);
// Indicar las columnas de la grilla
    $dhtmlx.='mygrid.setHeader("Tipo Manifiesto,Número Manifiesto,Tipo Contrato,Número Contrato,");'.chr(13);
$dhtmlx.='mygrid.setInitWidths("185,185,185,185,60");'.chr(13);
    $dhtmlx.='mygrid.setColAlign("left,left,left,left,center");'.chr(13);
$dhtmlx.='mygrid.setColTypes("ro,ro,ro,ro,link");'.chr(13);
$dhtmlx.='mygrid.setSkin("light");'.chr(13);
    $dhtmlx.='mygrid.enableEditEvents(true, true,false);'.chr(13);
    $dhtmlx.='mygrid.init();'.chr(13);
    $dhtmlx.='mygrid.loadXML("../../tmp/liq'.session_id().'.xml");'.chr(13);
    $dhtmlx.="mCal = new dhtmlxCalendarObject('_fechaelaboracion');".chr(13);
$dhtmlx.='mCal.draw();'.chr(13);
    $dhtmlx.='</script>'.chr(13);


Grid 2

    $string.='<script type="text/javascript">'.chr(13);
    $string.="mygrid = new dhtmlXGridObject('gridbox2');".chr(13);
    $string.='mygrid.setImagePath("../../html/default/images/");'.chr(13);
// Indicar las columnas de la grilla
    $string.='mygrid.setHeader("Contrato,Remitente,Cantidad,Destinatario,Origen,Destino,Sel");'.chr(13);
$string.='mygrid.setInitWidths("70,217,70,217,75,75,50");'.chr(13);
    $string.='mygrid.setColAlign("right,left,right,left,left,left,center");'.chr(13);
    $string.='mygrid.setColSorting("str,str,str,str,str,str,str");'.chr(13);
$string.='mygrid.setColTypes("ro,ro,ro,ro,ro,ro,ch");'.chr(13);
$string.='mygrid.setSkin("light");'.chr(13);
    $string.='mygrid.enableEditEvents(true, true,false);'.chr(13);
$string.='mygrid.attachEvent("OnCheck", mtransp.doOnCheck);'.chr(13);
$string.='mygrid.attachEvent("onRowDblClicked", mtransp.doDblClick);'.chr(13);
$string.='mygrid.init();'.chr(13);
    $string.='mygrid.loadXML("../../tmp/man'.session_id().'.xml");'.chr(13);
    $string.="mCal = new dhtmlxCalendarObject('_fechaelaboracion');".chr(13);
$string.='mCal.draw();'.chr(13);
    $string.='</script>'.chr(13);

Grid 3

    $string.='<script type="text/javascript">'.chr(13);
    $string.="mygrid = new dhtmlXGridObject('gridbox3');".chr(13);
    $string.='mygrid.setImagePath("../../html/default/images/");'.chr(13);
// Indicar las columnas de la grilla
    $string.='mygrid.setHeader("Fecha,Novedad,Valor,Estado,,");'.chr(13);
$string.='mygrid.setInitWidths("80,200,80,80,50,50");'.chr(13);
    $string.='mygrid.setColAlign("center,left,right,center,center,center");'.chr(13);
    $string.='mygrid.setColSorting("str,str,str,str,str,str");'.chr(13);
$string.='mygrid.setColTypes("ro,ro,ro,ro,link,link");'.chr(13);
$string.='mygrid.setSkin("light");'.chr(13);
    $string.='mygrid.enableEditEvents(true, true,false);'.chr(13);
    $string.='mygrid.init();'.chr(13);
    $string.='mygrid.loadXML("../../tmp/nov'.session_id().'.xml");'.chr(13);
    $string.='</script>'.chr(13);
Answer posted by dhxSupport on Oct 05, 2009 02:06
>>I have 3 grids in same form but grids that it has defined the attachEvents appears empty.
Unfortunately we cannot reproduce this issue locally. Please check example here http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/06_events/01_events_grid.html
Grid with attachEvent() loads well. 
Answer posted by Jorge Quesada on Oct 05, 2009 08:42
Thank you very much by its quick answer, but unfortunately it does not solve my question, because I have programs using one grid with attachEvents and work perfectly but this case of having to use 3 grid and one with the attachEvents is what I do not see like solving.

Best regards.

JORGE QUESADA.
Bucaramanga - Colombia
Answer posted by Stanislav (support) on Oct 06, 2009 01:45
attachEvent itself can't be a reason of problem, each dhtmlx object has such method, and calling it just save reference to the method, so there is very little space for an error. 
But the problem can be in the methods , which you attaching to the grid. 
          mygrid.attachEvent("OnCheck", mtransp.doOnCheck);
if in moment of code execution, mtransp object is not defined, the above code will throw an error which will stop any further initialization.