:: Forum >> Version 2 >>

Copy/Paste example?

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 
cratext = [];
        var 
cols this.getSelectedColumns();
        var 
rows this.getSelectedRows();
        if (
this.getCurrentSelection() == "row"){
            
cols = [];
            var 
count this.getColumnCount();
            var 
indices this.getColumnIndices();
            for (
c=0c<countc++){
                
cols[c] = indices ? indices[c] : c;
            }
        }
        for (
r=0r<rows.lengthr++){
            
= [];
            for (
c=0c<cols.lengthc++){
                
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.
Alex (ActiveWidgets)
Friday, May 9, 2008

Post a reply:

Text:
Name:

Back to support forum

Forum search