Monday, June 29, 2009

Validation Drag & Drop Infragisitics.

We are facing one problem in the Current project, The issue is dragging the jobs from source and droping to destination.

In the destination am doing validation, if the validation has fails. We should not drop the jobs and it should go back to the destination automatically. Still i didnt found the solution. Even had a discussion with the infragistics. hopefully will get the solution soon.

For the above i have found the alternate solution.

I am using the copy and paste method for dragging the jobs.

If the validation fails in the destionation. i will not drop the destionation. so no need to go back the source. Already will have to data in the source. Because we are using the copy and paste method.

Example


Sys.Application.add_load(appLoaded);
function appLoaded(){
var ddb = new $IG.DragDropBehavior();
var list = $get("imageList");
var count = list.childNodes.length;
var child;
for (var i = 0; i <>
child = list.childNodes[i];
if (child.getAttribute) {
ddb.addSourceElement(child);
}
}
ddb.addTargetElement($get("cartAreaDiv"), true);
ddb.get_events().addDropHandler(dropHandler);
}
function dropHandler(sender, args){
var srcItem = args.get_manager().get_source().element;
var target = $get("cartAreaDiv");
//debugger;
if (srcItem.id == "CD"){
alert("You can't add a CD!"); Validatiion got failed.
}
else{
target.appendChild(srcItem);
}
}