Posted 20 April 2018, 11:40 pm EST
I am tapping into paste dom eventlistner & pasted event to get the clipboard data and add clipboard data to datasource collection. This works as expected but wijmo is also adding the pasted data directly without going through this. How can i prevent that ? Or is this way not recommended ? Are there any better options where i can validate both pasted data and data in the source ?
new wjGrid.FlexGrid("#customergrid", {
autoGenerateColumns: false,
columns: this.gridColumns,
itemsSource: this.RawData,
allowAddNew: true,
pasted: this.Pasted,
});
Pasted(){
if (e.row == this.wjGrid.rows.length - 1) {
if (this.pastedData.split("\n").length > 1) {
var pastedDataArray = this.pastedData.split("\n");
for (var i = 1; i < pastedDataArray.length ; i++) {
// Add data to collection View
var newItem=this.wjGrid.editableCollectionView.addNew();
var itemToAdd = pastedDataArray[i].split("\t");
console.log('present');
//Validation & cleansing logic
newItem.someColumn = itemToAdd[1]; //cleansed data
this.wjGrid.editableCollectionView.commitNew();
}
}
}
this.wjGrid.select(e.row, e.col);
}