Env : SmartGWT Pro 2.3, MySQL.
Scenario : I have a treegrid with users and reporting to (inshort a company reporting hierarchy).
I m trying to implement the functionality to drag n drop user at any level.
Problem : If I drag a user and drop it on any of the managers I need the managers details to perform certain manipulations.
Question : How to get the record details of the target record/on which is the user is dropped i.e. the manager ?
If my approach is incorrect, Pls suggest me the correct way !! Any hint will
be helpful...
Thanks,
Scenario : I have a treegrid with users and reporting to (inshort a company reporting hierarchy).
I m trying to implement the functionality to drag n drop user at any level.
Problem : If I drag a user and drop it on any of the managers I need the managers details to perform certain manipulations.
Question : How to get the record details of the target record/on which is the user is dropped i.e. the manager ?
Code:
final TreeGrid hierarchyTreeGrid = new TreeGrid(); hierarchyTreeGrid.setLoadDataOnDemand(false); //hierarchyTreeGrid.setWidth("50%"); hierarchyTreeGrid.setWidth100(); hierarchyTreeGrid.setDataSource(userWorkNodesDataDS); hierarchyTreeGrid.setNodeIcon("icons/16/person.png"); hierarchyTreeGrid.setFolderIcon("tree/icons/base.gif"); hierarchyTreeGrid.setAlternateRecordStyles(Boolean.TRUE); hierarchyTreeGrid.setSmoothFade(Boolean.FALSE); hierarchyTreeGrid.setShowConnectors(true); hierarchyTreeGrid.setCanSort(false); hierarchyTreeGrid.setCanAcceptDroppedRecords(true); hierarchyTreeGrid.setCanDragRecordsOut(true); hierarchyTreeGrid.setCanReparentNodes(true); hierarchyTreeGrid.setCanReorderRecords(true); hierarchyTreeGrid.setShowDropIcons(false); hierarchyTreeGrid.setShowOpenIcons(false); hierarchyTreeGrid.setClosedIconSuffix(""); TreeGridField labelField = new TreeGridField("label"); hierarchyTreeGrid.setFields(labelField); hierarchyTreeGrid.setShowHeader(false); hierarchyTreeGrid.setAutoFetchData(false); hierarchyTreeGrid.fetchData(); hierarchyTreeGrid.addDropHandler(new DropHandler() { @Override public void onDrop(DropEvent event) { Record record = hierarchyTreeGrid.getSelectedRecord; ///NEED HELP HERE TO GET THE TARGET /Dropped record details ??? DSRequest dsRequest = new DSRequest(); SC.say(record.getAttribute("userId")); dsRequest.setAttribute("userId", hierarchyTreeGrid.getSelectedRecord().getAttribute("userId")); dsRequest.setAttribute("nodeId", hierarchyTreeGrid.getSelectedRecord().getAttribute("nodeId")); /*hierarchyTreeGrid.getDataSource().performCustomOperation("dragNodes", record , new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { } }, dsRequest);*/ } });
If my approach is incorrect, Pls suggest me the correct way !! Any hint will
be helpful...
Thanks,
Comment