Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by mongkol on Jul 10, 2008 18:40
open dhtmlx forum
Why it error?

I don't know why my code error?
----------------------------------------------------------------------
<html><head>
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href='http://localhost/DHTMLX/dhtmlxGrid/codebase/dhtmlxgrid.css'/>
<link rel="stylesheet" type="text/css" href='http://localhost/DHTMLX/dhtmlxGrid/codebase/dhtmlxgrid_skins.css' />
<script src='http://localhost/DHTMLX/dhtmlxGrid/codebase/dhtmlxcommon.js'></script>
<script src='http://localhost/DHTMLX/dhtmlxGrid/codebase/dhtmlxgrid.js'></script>        
<script src='http://localhost/DHTMLX/dhtmlxGrid/codebase/dhtmlxgridcell.js'></script>
</head>
<body>
<div id="grid_1" style="width:400px; height:150px;"></div>
<script>
    function doOnCheck(rowId,cellInd,state){
        alert("Some thing");
        return true;
    }
    mygrid = new dhtmlXGridObject("grid_1");
    mygrid.setImagePath("http://localhost/DHTMLX/dhtmlxGrid/sources/imgs/");

/*------------------------------------------------------------------------------------*/

    mygrid.setOnCheckHandler(doOnCheck); // This code work when i comment this line

/*------------------------------------------------------------------------------------*/

    mygrid.enableAutoHeigth(true);    
    mygrid.init();
    mygrid.setSkin("light");
    mygrid.loadXMLString('<?xml version="1.0"?><rows><head><column width="300" type="ro" align="center" id="Desc">Description</column><column width="80" type="ch" align="center" id="select">Select</column></head><row id="0"><cell>(E)Contributo costo costruzione (incassati)</cell><cell>0</cell></row><row id="1"><cell>(E)Oneri secondari (incassati)</cell><cell>0</cell></row><row id="2"><cell>(E)Oneri primari (incassati)</cell><cell>0</cell></row><row id="3"><cell>(E)Totale importo oneri PRIMARI</cell><cell>0</cell></row><row id="4"><cell>(E)Totale importo costo di costruzione RESIDENZIALE</cell><cell>0</cell></row></rows>');
    </script></body>
</html>
Answer posted by Support on Jul 11, 2008 01:29
Starting from dhtmlxgrid 1.6 the way to attach|detach event handlers was changed.
    http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Migrating_to_16.html#grid_art_mig16

You need to use new syntax
    mygrid.attachEvent("onCheckbox",doOnCheck);
or include
    dhtmlxgrid/codebase/ext/dhtmlxgrid_deprecated.js
to be able to use old events syntax.