Dhtmlgrid

Hi,



I had an issue in the datagrid… when I used a radio or a check box and attached a doCheck event with it… It recognized only the first click. Subsequent events it fails to trigger the function…


Please check if your “onCheck” event handler return true:


mygrid.attachEvent(“onChekc”,function(){


//some code


return true;


})


If issue still occur please provide us any kind of sample where we can reproduce this issue

            mygrid = new dhtmlXGridObject(‘mygrid_container’);
            mygrid.setImagePath(“codebase/imgs/”);
           
            mygrid.setInitWidths(“80,200,*,75”);
            mygrid.setColAlign(“center,center,center,center”);
            mygrid.setSkin(“modern”);
            mygrid.setColTypes(“ro,ro,ed,ra”);
       
            mygrid.attachEvent(“onCheck”,doOnRadioCheck);
              
            mygrid.init();
            mygrid.parse(data_array,“jsarray”);


function doOnRadioCheck(rowId,cellInd,newvalue){
                alert(‘2’ +  ’ ’ + rowId + ’  '+ cellInd);
                 
                    if(mygrid.cells(rowId,cellInd).getValue() == “1”){
                        var tmpId = “Circle” + (mygrid.cells(rowId,0).getValue() - 1);
                        document.getElementById(tmpId).innerHTML = ‘’;
                        data_array.splice(rowId -1,1);
                        mygrid_refresh();
                        return true;
                    }
                 }   

            function mygrid_refresh(){
 
                mygrid.clearAll()
                mygrid.parse(data_array,“jsarray”)
            }

oops let me clarify some points…


data_array would contain data like xx,xx,xx,false…
now on click i remove an element from the data_array by clearing its innerhtml…

this works fine in firefox  but in IE 6&7 it gives an issue like after 1 or sometimes 2 click the function does not get called.
I have even used onrowedit its is the same case as above.


            mygrid = new dhtmlXGridObject(‘mygrid_container’);
            mygrid.setImagePath(“codebase/imgs/”);
           
            mygrid.setInitWidths(“80,200,*,75”);
            mygrid.setColAlign(“center,center,center,center”);
            mygrid.setSkin(“modern”);
            mygrid.setColTypes(“ro,ro,ed,ra”);
       
            mygrid.attachEvent(“onCheck”,doOnRadioCheck);
              
            mygrid.init();
            mygrid.parse(data_array,“jsarray”);


function doOnRadioCheck(rowId,cellInd,newvalue){
                alert(‘2’ +  ’ ’ + rowId + ’  '+ cellInd);
                 
                    if(mygrid.cells(rowId,cellInd).getValue() == “1”){
                        var tmpId = “Circle” + (mygrid.cells(rowId,0).getValue() - 1);
                        document.getElementById(tmpId).innerHTML = ‘’;
                        data_array.splice(rowId -1,1);
                        mygrid_refresh();
                        return true;
                    }
                 }   

            function mygrid_refresh(){
 
                mygrid.clearAll()
                mygrid.parse(data_array,“jsarray”)
            }

Try to change your code like that:
function doOnRadioCheck(rowId,cellInd,newvalue){
alert(‘2’ + ’ ’ + rowId + ’ '+ cellInd);

if(mygrid.cells(rowId,cellInd).getValue() == “1”){
var tmpId = “Circle” + (mygrid.cells(rowId,0).getValue() - 1);
document.getElementById(tmpId).innerHTML = ‘’;
data_array.splice(rowId -1,1);
mygrid_refresh();
return true;

}


return true;


}

Apparently that didn’t work too…

We cannot reproduce this issue locally. Your code sample is correct ans works well. Please contact support@dthml.com and send sample where we can recreate this issue including files which you are using to init grid.