5 Replies Latest reply: May 24, 2013 3:24 AM by Carl Hammond RSS

    Default value of radio button on first row in table

    Carl Hammond
      Hi,

      I have created a custom page which includes a table ("SuppliersTable"), the table has a singleSelection table component (radio button) linked to a transient attribute ("SelectFlag") in a VO ("ApSuppliersVO"). The table is populated from a Query region.

      I would like to 'select' the radio button on the first row of the table by default when a query is executed (when a user clicks "Go"), I have tried the following but its not setting the value:

      In CO:
              if (pageContext.getParameter(go) != null) {
                  System.out.println("The GO button was pressed");
                  am.invokeMethod("handleFirstRows");
              }
      In AMImpl:
          public void handleFirstRows() {
              System.out.println("1");
              OAViewObject suppliersVO = 
                  (OAViewObject)findViewObject("ApSuppliersVO");
              if (suppliersVO != null) {
                  System.out.println("2");
                  int rowcnt = suppliersVO.getRowCount();
                  System.out.println("RowCount:" + rowcnt);
                  if (suppliersVO.getFetchedRowCount() != 0) {
                      System.out.println("3");
                      //OARow supplierRow = (OARow)suppliersVO.first();
                      Row supplierRow1 = suppliersVO.first();
                      supplierRow1.setAttribute("SelectFlag", "Y");
                  }
              }
          }
      Based on the debug messages I can see that it is calling the procedure, but either not setting the value, or not setting it in a way that renders it on the page and forces the event that goes with it.

      Am I missing something/doing it completely wrong? How can I best achieve this?


      JDEV 10.1.3.3.0
      EBS 12.1.3


      Kind Regards
      Carl
        • 1. Re: Default value of radio button on first row in table
          keerthioaf
          Hey hi Carl,

          Its pretty much correct , well , can you try the below code .

          OAViewObject localOAViewObject1 = (OAViewObject)am.findViewObject("ProjectDatesVO");
          if(localOAViewObject1!=null) {
          Row DateVoROw = localOAViewObject1.first();
          RowSetIterator iterator = localOAViewObject1.createRowSetIterator("iterator");
          iterator.setRangeStart(0);
          iterator.setRangeSize(localOAViewObject1.getRowCount());
          for(int i=0; i<iterator.getRowCount(); i++)
          {

          DateVoROw=iterator.getRowAtRangeIndex(1); // represents first row
          if(DateVoROw!=null)
          {
          // set the value here .
          }
          }

          Kindly Let me know the update .

          --Keerthi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
          • 2. Re: Default value of radio button on first row in table
            keerthioaf
            Hi Carl ,


            Another thing i have notice is that if you are using Oracle standard query mode ( Result based search / auto customization ) then
            you can handle the Go button in following way ( pageContext.getParameter("Go") will not work )


            here is the code .

            OAApplicationModule ap = (OAApplicationModule)pageContext.getApplicationModule(webBean);
            OAQueryBean bean = (OAQueryBean)webBean.findIndexedChildRecursive("*queryRN*"); // Id of the query region
            if(bean!=null)
            {
            String id = (String)bean.getGoButtonName();
            if(pageContext.getParameter(id)!=null)
            {
            ap.invokeMethod("Method_name",params);

            if you are not passing any parameter then

            ap.invokeMethod("Method_name",null);

            }



            --keerthi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
            • 3. Re: Default value of radio button on first row in table
              Sandeep M.
              Hi Carl,

              If it is printing messages 1 , 2 and 3 that means it is calling your method and setting the values.
              Now here is what may be happening.

              Since it is standard query region it is executing the VO and it is doing that after you setting the value of SelectFlag and override the value.

              I can suggest another way of doing this. you can take SelectFlag as one of the query column in ApSuppliersVO and setting its value to Y when rownum is 1 else null in query itself. Is it possible for you?
              That can solve your issue.
              • 4. Re: Default value of radio button on first row in table
                Carl Hammond
                Hi Keerthi,

                I tried your solution, however the value was still not being set (or not being set in a way that is visible in the form).

                Sandeep - I had started to think that was the case, so I will handle it in the VO instead.

                Many thanks for your responses.

                Carl
                • 5. Re: Default value of radio button on first row in table
                  Carl Hammond
                  Hi Keerthi,

                  I tried your solution, however the value was still not being set (or not being set in a way that is visible in the form).

                  Sandeep - I had started to think that was the case, so I will handle it in the VO instead.

                  Many thanks for your responses.

                  Carl