This discussion is archived
5 Replies Latest reply: Jan 21, 2013 11:42 AM by 730040 RSS

parameter passing not getting refresh in ADF mobile

730040 Newbie
Currently Being Moderated
hi,

i am trying to pass parameter from one page to another page in ADF mobile.

here is what i am doing-
1. first page ---shows list of Departments ---(i have a datacontrol for this and this is working fine)

2. when an employee is selected it would navigate to a new page which would show list of employees for that selected department in the first page. ( i have a second data control which has a parameter for deptId and returns list of employees in that dept; there is a back button in this page which takes the user to the first page;)

issue-
i have two issues here-
a. when i select the first row in #1 page, it invokes the second page and shows the list of employees in that department > click the back button to go to previous page > then select another department. but this time it again shows the employees from the first selected department. does not show the newly selected department's employees.

b. open the app > if i select any row in the #1 page other than the first row, the second page does not show any result. so it only works for the first record in #1 page.


please let me know if i am missing anything?

please help.

regards,
ad
  • 1. Re: parameter passing not getting refresh in ADF mobile
    730040 Newbie
    Currently Being Moderated
    i could resolve issue #b by adding following to the DeptListPageDef.xml

    <methodAction id="Execute" InstanceName="data.DepartmentList.dataProvider" DataControl="DepartmentList"
    RequiresUpdateModel="true" Action="invokeMethod" MethodName="Execute" IsViewObjectMethod="false"/>

    not sure why this was missing. do we need to add the above line manually always?

    i still have issue#a-
    the second page is always showing same result. sounds like the underlying Javaclass method is not getting called every time you select a new value in the previous page?

    any help would be great.

    thanks,
    ad
  • 2. Re: parameter passing not getting refresh in ADF mobile
    user404 Pro
    Currently Being Moderated
    You will need to use propertyChangeSupport (for attributes) or providerChangeSupport (for collections).
    It's explained here :
    http://docs.oracle.com/cd/E35521_01/doc.111230/e24475/amxbinding.htm#CHDHFGAF
  • 3. Re: parameter passing not getting refresh in ADF mobile
    730040 Newbie
    Currently Being Moderated
    not sure how to set that.

    i created the employee data control based on the following class.
    and my .amx page is based on this data control. i am passing the parameter using the pageFlowScope variable.
    first time it works but next time onwards it shows me the same data.



    public Employee[] getEmployeeListForDept1(int pdeptNo){

    System.out.println(" ---in getemployee....1.."+pdeptNo);

    try{

    Connection conn = MyDBConnectionFactory.getConnection();
    conn.setAutoCommit(false);
    PreparedStatement pStmnt = conn.prepareStatement("SELECT * FROM EMPLOYEES "
    + "WHERE DEPARTMENT_ID = " + pdeptNo
    + " ORDER BY FIRST_NAME");

    System.out.println(" ---in getemployee....2.."+pdeptNo);

    ResultSet rSet = pStmnt.executeQuery();
    int s_empid, s_mgr_id, s_dept_id;
    String s_first_name, s_last_name, s_email, s_phone, s_job_id;
    double s_salary;
    double s_commPct;
    Date s_hiredt;

    int s_list_size = s_emp_list1.size();

    System.out.println("---in getemployee....3.."+pdeptNo);


    s_emp_list1.clear();

    System.out.println("---in getemployee....4.."+pdeptNo);


    while (rSet.next()){

    System.out.println(" ---in getemployee....4.1.."+pdeptNo);

    s_empid = rSet.getInt("EMPLOYEE_ID");
    s_mgr_id = rSet.getInt("MANAGER_ID");
    s_dept_id = rSet.getInt("DEPARTMENT_ID");
    s_first_name=rSet.getString("FIRST_NAME");
    s_last_name=rSet.getString("LAST_NAME");
    s_email=rSet.getString("EMAIL");
    s_phone=rSet.getString("PHONE_NUMBER");
    s_job_id=rSet.getString("JOB_ID");
    s_salary=rSet.getDouble("SALARY");
    s_commPct=rSet.getDouble("COMMISSION_PCT");
    s_hiredt = rSet.getDate("HIRE_DATE");

    System.out.println(" ---in getemployee....5.."+pdeptNo);


    s_emp_list1.add(new Employee(s_empid,s_mgr_id,s_dept_id,s_first_name,s_last_name,s_email,s_phone,s_job_id,s_salary,s_commPct,s_hiredt));

    System.out.println(" ---in getemployee....6.."+pdeptNo);

    }

    rSet.close();

    System.out.println("---in getemployee....7.."+pdeptNo);


    } catch(SQLException e){
    System.err.println(e.getMessage());
    }catch (Exception e){
    System.err.println(e.getMessage());
    }

    Employee[] empArray1 = null;

    if (s_emp_list1.size()!=0){
    empArray1 = (Employee[])(s_emp_list1.toArray(new Employee[s_emp_list1.size()]));
    }

    System.out.println("---in getemployee....8.."+pdeptNo);

    providerChangeSupport.fireProviderRefresh("EmployeesList");


    return empArray1;



    }
  • 4. Re: parameter passing not getting refresh in ADF mobile
    user404 Pro
    Currently Being Moderated
    Did you add :
    protected transient ProviderChangeSupport 
                           providerChangeSupport = new ProviderChangeSupport(this);
    ?
    And :
    public void addProviderChangeListener(ProviderChangeListener l) {
            providerChangeSupport.addProviderChangeListener(l);
        }
     
        public void removeProviderChangeListener(ProviderChangeListener l) {
            providerChangeSupport.removeProviderChangeListener(l);
        }
    (not sure if this required, but adding it won't cause any problems)

    And I assume that 'EmployeesList' is the name of your collections in the bindings of your page?


    Edit:
    You should fire the 'providerChangeSupport.fireProviderRefresh("EmployeesList");' in the method you use to navigate to the other page.
    If you are just using the taskflow navigation, you can add and amx:actionListener which calls a method from your bean where you fire the refresh.
    That way, the getter method will be called.

    Edited by: user404 on 21-jan-2013 10:16
  • 5. Re: parameter passing not getting refresh in ADF mobile
    730040 Newbie
    Currently Being Moderated
    hi,

    let me try adding "providerChangeSupport.fireProviderRefresh("EmployeesList")" this as per you suggestion.
    i am using task flow navigation.

    are you suggesting to add a method to my EmployeeList bean?
    and use that method in the "ActionListner" of the source page's list item?
    so that when the list item is touched, it would fire the refresh of the EmployeeList bean?

    rest all are already there.

    thanks,
    ad

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points