Dran 'n' Drop solution is not working in servoy 6 rc1

Questions, tips and tricks and techniques for scripting in Servoy

Dran 'n' Drop solution is not working in servoy 6 rc1

Postby sambitc » Wed Jul 20, 2011 1:36 pm

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 :?
Last edited by sambitc on Wed Jul 20, 2011 2:31 pm, edited 1 time in total.
sambitc
 
Posts: 6
Joined: Mon Jan 17, 2011 9:14 am

Re: Dran 'n' Drop solution is not working in servoy 6

Postby Gabi Boros » Wed Jul 20, 2011 1:57 pm

this is fixed in RC4
Gabi Boros
Servoy
Gabi Boros
 
Posts: 404
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania


Return to Methods

Who is online

Users browsing this forum: No registered users and 17 guests