Anyoe have a 2.5.1 copy/paste example or direct me somewhere where I can read more about it? TIA.
Jimmy
Tuesday, May 6, 2008
At this moment you only can look at the source code - /source/lib/grid/control.js (line 469-530). When you copy the data from the grid the getSelectedText() method is called, which you can overwrite if you need to change something. Here is the default implementation -
obj.getSelectedText = function(){
var c, r, a, text = [];
var cols = this.getSelectedColumns();
var rows = this.getSelectedRows();
if (this.getCurrentSelection() == "row"){
cols = [];
var count = this.getColumnCount();
var indices = this.getColumnIndices();
for (c=0; c<count; c++){
cols[c] = indices ? indices[c] : c;
}
}
for (r=0; r<rows.length; r++){
a = [];
for (c=0; c<cols.length; c++){
a[c] = this.getCellText(cols[c], rows[r]);
}
text[r] = a.join("\t");
}
return text.join("\r\n");
};
When the data is pasted into the cell - the startCellEdit() method is called. That only works for a single cell. Multiple cell/rows pasting is not supported.