Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Drag Drop with confirmation message

$
0
0
SmartGWT version: SmartClient Version: v9.1p_2014-03-04/PowerEdition Deployment (built 2014-03-04)
Browser: FireFox ESR 24.3.0, with FireBug installed

Hi,

I am creating a drag/drop page that has 4 VStack lanes and individual drag-able labels in the lanes. Users would like to get a confirmation pop-up (that requires a trip to the server to get data) upon dragging the label to another lane. Problem is I cannot cancel the drag event if the user clicks "No" on the pop-up, it looks like the event has been "committed" when the pop-up happens.

Below is a sample of what I am trying to do, is there a way to do this? Thanks.

Code:

rivate VStack createLane(final String id,
                        final String[] dropTypes) {
                final VStack lane = new VStack();
                lane.setID(id);
                lane.setShowEdges(true);
                lane.setMembersMargin(5);
                lane.setLayoutMargin(5);
                lane.setCanAcceptDrop(true);
                lane.setAnimateMembers(true);
                lane.setDropLineThickness(3);
                lane.setEdgeSize(1);
                lane.setHeight100();
                lane.setDropTypes(dropTypes);               
                lane.addDropHandler(new DropHandler() {
                        @Override
                        public void onDrop(final DropEvent event) { 
                final Canvas target = EventHandler.getDragTarget();
                                //Suppose to involve a server call to get some data first
                SC.ask("Please confirm the move", new BooleanCallback() {
                                        @Override
                                        public void execute(final Boolean value) {                                               
                                                if (value) {                                                       
                                                        updateData();
                                                } else {
                                                        //Cannot undo the move here
                                                        event.cancel();
                                                }
                                        }                                                                               
                                });
            }
                });
                return lane;
        }


Viewing all articles
Browse latest Browse all 4756

Trending Articles