Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by viswesh on Apr 09, 2009 03:23
open dhtmlx forum
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..
Answer posted by dhxSupport on Apr 09, 2009 03:28

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

Answer posted by viswesh on Apr 09, 2009 03:40
            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")
            }
Answer posted by viswesh on Apr 09, 2009 03:45
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.


Answer posted by viswesh on Apr 09, 2009 03:50
            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")
            }
Answer posted by dhxSupport on Apr 09, 2009 06:26
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;

  }  

Answer posted by viswesh on Apr 09, 2009 07:37
Apparently that didn't work too..
Answer posted by dhxSupport on Apr 09, 2009 08:39
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.