Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Anderson on Oct 08, 2007 22:10
open dhtmlx forum
getValue - all values grid

Hi,

I'm a problem while running this code:

function onKeyPressed(code,ctrl,shift){
   if(code==67&&ctrl){
      mygrid.setCSVDelimiter("\t")
      mygrid.copyBlockToClipboard()
  }

if(code==86&&ctrl){
   mygrid.pasteBlockFromClipboard()
   mygrid.selectRow(0);
   //cols count
   var oCols = mygrid.getColumnCount();
   //rows count
   var oRows = mygrid.getRowsNum();
   for(x=0;x<oCols;x++)
   { 
      for(y=0;y<oRows;y++)
      {
          try
          {
              alert(mygrid.cells(x,y).getValue());
           }catch(e) {
                alert('Err : ' + e.number + '\nDescription : ' + e.description + '.');
           }
       }
   }
   
  }
  return true; 
  }

The procedure is to rescue all the values of the cells and to compare when paste them
Thanks!
Answer posted on Oct 09, 2007 13:02
>>alert(mygrid.cells(x,y).getValue());

The syntax of cells command is
    cells(rowId, cellIndex) - it mixed up in your case
The correct code will be

    alert(mygrid.cells2(y,x).getValue());

I used cells2 because it works with row indexes and more appropriate in your case