Hello All,
This tutorial is based on using Drag & Drop functionality in collections as af:table to create a new row
i have googled about Drag & Drop but was not able to implement in page fragments(.jsff), all samples was based on JSPX page.
this tutorial is based on DEPARTMENTS table (Default HR Schema) and an other table with Same Structure DEPARTMENTS_DUPL to implement drag and drop.
my scenario is to add row in DEPARTMENTS_DUPL from Departments
See the steps to implement-
This tutorial is based on using Drag & Drop functionality in collections as af:table to create a new row
i have googled about Drag & Drop but was not able to implement in page fragments(.jsff), all samples was based on JSPX page.
this tutorial is based on DEPARTMENTS table (Default HR Schema) and an other table with Same Structure DEPARTMENTS_DUPL to implement drag and drop.
my scenario is to add row in DEPARTMENTS_DUPL from Departments
See the steps to implement-
- First create Departments_dupl table in your HR schema, simply run this script
- Now create Fusion Web Application and create business components
CREATE TABLE DEPARTMENTS_DUPL ( DEPARTMENT_ID NUMBER(4, 0) , DEPARTMENT_NAME VARCHAR2(30 BYTE) , MANAGER_ID NUMBER(6, 0) , LOCATION_ID NUMBER(4, 0) )
- Now create a bounded taskflow and a page fragment in it, and drop both tables on page
- Now drop af:dragSource as child of Departments table and set properties, here discriminant is to ensure compatibility between drag and drop components, and its value must match for Drag source and Drop Target
- now drop af:dropTarget as child of DepartmentsDupl table and set properties as Action etc and create a DropListener for it that handles drop event, set Flavor class to java.lang.Object
- Now select af:dropTarget and goto source and set value for discriminant same as drag source
- Now write code to create a new row in DepartmentsDupl and insert data from Departments on Drop Listener
- Now Run your page and use this cool functionality :-)
<af:dropTarget dropListener="#{pageFlowScope.DragDropSampleBean.deptDropListener}" actions="COPY"> <af:dataFlavor discriminant="copyDept" flavorClass="java.lang.Object"/> </af:dropTarget>
public void dragDropAction() { ViewObject dept = this.getDepartments1(); ViewObject deptDupl = this.getDepartmentsDupl1(); Row curDept = dept.getCurrentRow(); Row dupl = deptDupl.createRow(); dupl.setAttribute("DepartmentId", curDept.getAttribute("DepartmentId")); dupl.setAttribute("DepartmentName", curDept.getAttribute("DepartmentName")); dupl.setAttribute("ManagerId", curDept.getAttribute("ManagerId")); dupl.setAttribute("LocationId", curDept.getAttribute("LocationId")); deptDupl.insertRow(dupl); deptDupl.executeQuery(); this.getDBTransaction().commit(); }
very good one .. i really liked it
ReplyDelete