Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by C. Bernstein on May 01, 2009 11:58
open dhtmlx forum
Clear Clipboard When Hiding Columns

What is the best way to clear the clipboard upon hiding a column in a grid? The problem is that when the clipboard is full with all of the column data and then a column gets hidden, and then a user pastes the clipboard, they will see the hidden column data (since it was on the clipboard before they hid the column). So I would like to clear the clipboard each time a column is hidden or revealed. I am trying the following but it isn't working:

StdGrid.prototype.doOnColumnHiding = function () {    
for (var i = 0;i < this.dhxGrid.getColumnsNum();i++) {
if (this.dhxGrid.isColumnHidden(i)) {
this.dhxGrid._srClmn[i] = false;
}

else
this.dhxGrid._srClmn[i] = true;
}

window.clipboardData.setData("Text",'');
this.dhxGrid.gridToClipboard();
}
Answer posted by Support on May 01, 2009 14:57
Grid (2.0+) has inner event - onColumnHidden

mygrid.attachEvent("onColumnHidden",function(index,state){
          this.toClipBoard("");//clear clipboard
          return true;
});