PROBLEM :-
I have imported a Drag 'n' Drop solution from the url "http://forum.servoy.com/viewtopic.php?f=22&t=13507&start=45". It is working fine for servoy 5.2.4 web-client(not for smart-client). When I tried the solution in servoy 6 rc1 it is not working for both web and smart client.
METHODS USED:
---------------------------
function onDrag(event) {
if(!event.getSource()){
return DRAGNDROP.NONE;
}
var data = [];
var selection = foundset.getSelectedIndexes();
for(i in selection){
data.push(foundset.getRecord(selection[i]));
}
event.data = data;
return DRAGNDROP.COPY|DRAGNDROP.MOVE;
}
---------------------------
--------------------------
function onDrop(event) {
for(i in event.data){
/** @type {JSRecord<db:/example_data/products>}*/
var record = event.data[i];
// Check if the order already has a order_detail for this product
var fs = foundset.duplicateFoundSet();
if(fs.find()){
fs.productid = record.productid;
if(fs.search()){ //product exists in order, increment quantity
fs.quantity += 1;
} else if(foundset.newRecord()){ //product did NOT exist, add a new record
productid = record.productid;
unitprice = record.unitprice;
quantity = 1;
discount = 0.0;
}
}
}
databaseManager.saveData();
return true;
}
-----------------------------------------
At the time of dragging method "onDrag(event)" is called but at the time of dropping the solution unable to call "onDrop(event)" method.
After that I have added another method "onDragEnd(event)"
function onDragEnd(event) {
// TODO Auto-generated method stub
application.output( event.getDragResult());
}
In onDrag(event) I am returning "DRAGNDROP.COPY|DRAGNDROP.MOVE" but surprisingly on "onDragEnd(event)" method event.getDragResult() returns 0 instead of 1.
So, I need help