ind | integer, index of the record |
col_ind | integer, index of the column |
let grid = new w2grid({
name: 'grid',
columns: [
{ field: 'recid', text: 'ID', size: '50px' },
{ field: 'lname', text: 'Last Name', size: '30%' },
{ field: 'fname', text: 'First Name', size: '30%',
clipboardCopy: true
},
{ field: 'email', text: 'Email', size: '40%',
clipboardCopy: 'Email coppied!!'
},
{ field: 'sdate', text: 'Start Date', size: '120px',
clipboardCopy(ind, col_ind) {
let rec = this.records[ind]
return rec.lname + ', ' + rec.fname
}
},
{ field: 'sdate', text: 'End Date', size: '120px' }
],
records: [
{ recid: 1, fname: 'John', lname: 'doe', email: 'vitali@gmail.com', sdate: '1/3/2012' },
{ recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '2/4/2012' },
{ recid: 3, fname: 'Jin', lname: 'Franson', email: '--', sdate: '4/23/2012' },
{ recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '5/3/2012' },
{ recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 6, fname: 'Francis', lname: 'Gatos', email: 'vitali@gmail.com', sdate: '2/5/2012' }
]
});
xxxxxxxxxx
w2ui.grid.clipboardCopy(0, 2);
xxxxxxxxxx
let grid = new w2grid({
name: 'grid',
clipboardCopy(ind, col_ind) {
let rec = this.records[ind]
return rec.lname + ', ' + rec.fname
},
columns: [
{ field: 'recid', text: 'ID', size: '50px' },
{ field: 'lname', text: 'Last Name', size: '30%' },
{ field: 'fname', text: 'First Name', size: '30%', clipboardCopy: true },
{ field: 'email', text: 'Email', size: '40%', clipboardCopy: true },
{ field: 'sdate', text: 'Start Date', size: '120px' },
{ field: 'sdate', text: 'End Date', size: '120px' }
],
records: [
{ recid: 1, fname: 'John', lname: 'doe', email: 'vitali@gmail.com', sdate: '1/3/2012' },
{ recid: 2, fname: 'Stuart', lname: 'Motzart', email: 'jdoe@gmail.com', sdate: '2/4/2012' },
{ recid: 3, fname: 'Jin', lname: 'Franson', email: '--', sdate: '4/23/2012' },
{ recid: 4, fname: 'Susan', lname: 'Ottie', email: 'jdoe@gmail.com', sdate: '5/3/2012' },
{ recid: 5, fname: 'Kelly', lname: 'Silver', email: 'jdoe@gmail.com', sdate: '4/3/2012' },
{ recid: 6, fname: 'Francis', lname: 'Gatos', email: 'vitali@gmail.com', sdate: '2/5/2012' }
]
});