Skip to Main Content

Problems refreshing af:table

areyesJul 3 2015 — edited Jul 13 2015

Hi,

I am developing an application using JDeveloper and ADF 11g 11.1.3.

On one page I have a table and a button. When you click on the button it calls a function database that modifies and insert table data. Then I do a commit and refresh the table.

  <af:table value="#{bindings.IncidenciasVisIncidenciasView.collectionModel}"

                  var="row" styleClass="tabla-incidencias"

                  rows="#{bindings.IncidenciasVisIncidenciasView.rangeSize}"

                  emptyText="#{bindings.IncidenciasVisIncidenciasView.viewable ? 'No se han encontrado incidencias.' : 'Acceso denegado.'}"

                  fetchSize="#{bindings.IncidenciasVisIncidenciasView.rangeSize}"

                  rowBandingInterval="1"

                  selectedRowKeys="#{bindings.IncidenciasVisIncidenciasView.collectionModel.selectedRow}"

                  selectionListener="#{visIncidenciasBean.seleccionTabla}"

                  rowSelection="single" id="t1"

                  columnStretching="column:c9"

                  partialTriggers="::boton_aceptar_incidencia"

                  inlineStyle="height:200.0px;"

                  binding="#{gestionBean.tablaIncidencias}">

  <af:commandButton text="Aceptar" id="boton_aceptar_incidencia"

                          partialSubmit="true"

                          action="#{visIncidenciasBean.pasar_incidencia_a_leida}"/>

 

This is the code refresh:

   

    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();

       DCBindingContainer bc = (DCBindingContainer) bindings;

       DCIteratorBinding dciter = bc.findIteratorBinding("IncidenciasVisIncidenciasViewIterator");

       if(dciter!=null)

       {

          if(dciter.getCurrentRow()!=null)

          {   

            Key current_row_key = dciter.getCurrentRow().getKey();

            dciter.executeQuery();

            if(current_row_key!=null)

            {

              try

              {

                dciter.setCurrentRowWithKey(current_row_key.toStringFormat(true));

              }

              catch(Exception ex)

              {

                System.out.println("Exception in current_row_key");

              }

            }

          }

       }

   

The table refreshes correctly. The problem is that records are not sorted. In the view object data is sorted by descending date.

The table has the following information:

column1   column2   column3

215          3              03-07-2015 10:26:01

455          1              03-07-2015 10:25:53

487          1              03-07-2015 10:25:40  --> This is the selected record

321          0              03-07-2015 10:22:23

After refreshing the table is as follows:

column1   column2   column3

525          1              03-07-2015 10:27:42  --> New record

251          0              03-07-2015 10:27:12  --> New record

487          1             03-07-2015 10:25:40  --> This is the selected record

215          3             03-07-2015 10:26:01

455          1             03-07-2015 10:25:53

321          0             03-07-2015 10:22:23

It is as if ordered as follows:

- First new records

- After recording the selected and modified. (The record was modified with the function of database)

- After remaining rows in the order they already had.

Could anyone help me please? Thanks in advance.

Regards.

Comments
Post Details
Added on Jul 3 2015
15 comments
1,936 views