12 Replies Latest reply: Feb 18, 2013 3:54 AM by DilipG RSS

    table cannot be sorted because it has pending changes which would be lost

    Siva Prasad Nidimamidi
      Hi All,

      I have two colums adding dynamically to the result table. when i click on sort then its throwing an warning
      "The table cannot be sorted because it has pending changes which would be lost."

      Can any one please help?

      Thanks,
      Siva Prasad.
        • 1. Re: table cannot be sorted because it has pending changes which would be lost
          shreevat
          Check these links

          The table cannot be sorted because it has pending changes which were lost
          https://kr.forums.oracle.com/forums/thread.jspa?threadID=932423

          Thanks
          Shree
          • 2. Re: table cannot be sorted because it has pending changes which would be lost
            Kalimuthu V-Oracle
            Hi Siva,
            In your VORowImpl.java use populateAttribute() instead of setAttribute for the transient attributes like
            selectFlag...etc, that should solve your issue.

            Thanks,

            With regards,
            Kali.
            OSSi.
            • 3. Re: table cannot be sorted because it has pending changes which would be lost
              Siva Prasad Nidimamidi
              Hi ,

              Can you please elaborate the solution.

              my code in vorowimpl.java
              public void setGbv(String value) {
              OADBTransactionImpl localOADBTransactionImpl =
              (OADBTransactionImpl)getApplicationModule().getTransaction();
              localOADBTransactionImpl.writeDiagnostics(this, "setGbv-" + value, 1);
              setAttributeInternal(GBV, value);


              --siva                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
              • 4. Re: table cannot be sorted because it has pending changes which would be lost
                Kalimuthu V-Oracle
                Hi Siva,
                Can you try like below,

                public void setGbv(String value) {
                OADBTransactionImpl localOADBTransactionImpl =
                (OADBTransactionImpl)getApplicationModule().getTransaction();
                localOADBTransactionImpl.writeDiagnostics(this, "setGbv-" + value, 1);
                populateAttribute(GBV, value);
                }

                Thanks,

                With regards,
                Kali.
                OSSi.
                • 5. Re: table cannot be sorted because it has pending changes which would be lost
                  Siva Prasad Nidimamidi
                  I have tried using populateAttribute(), no luck.

                  Could suggest any other solution?

                  --siva                                                                                                                                                                                               
                  • 6. Re: table cannot be sorted because it has pending changes which would be lost
                    Kalimuthu V-Oracle
                    1) If you dont have your new two objects the sort working fine?
                    2) What are the other transient attributes in your VO
                    3) All the transient attributes updatable set to Never?
                    4) this method setGbv is in your VORowImpl
                    5) You have added the two new attributes by extending the VO?

                    Thanks,

                    With regards,
                    Kali.
                    OSSi.
                    • 7. Re: table cannot be sorted because it has pending changes which would be lost
                      Siva Prasad Nidimamidi
                      1) If you dont have your new two objects the sort working fine? -- Yes , Its working good.
                      2) What are the other transient attributes in your VO -- GBV and ASSETTYPE

                      --GBV
                      public void setGbv(String value) {
                      OADBTransactionImpl localOADBTransactionImpl =
                      (OADBTransactionImpl)getApplicationModule().getTransaction();
                      localOADBTransactionImpl.writeDiagnostics(this, "setGbv-" + value, 1);
                      setAttributeInternal(GBV, value);

                      --ASSETTYPE
                      public void setAssetType(String value) {
                      setAttributeInternal(ASSETTYPE, value);

                      3) All the transient attributes updatable set to Never?-- I dont know how to set, can you guide me?

                      4) this method setGbv is in your VORowImpl --Yeah its in VORowImpl

                      5) You have added the two new attributes by extending the VO? -- Yeah

                      ---Siva
                      • 8. Re: table cannot be sorted because it has pending changes which would be lost
                        Marcin
                        Hi Siva,

                        I had the same issue in 11i and JDeveloper 9.0.3.5.

                        The problem was the in *VO.xml file.

                        JDeveloper geneted *VO.xml with wrong attributes types.

                        Eg.
                        was

                        <ViewAttribute
                        Name="CreditRequestId"
                        IsPersistent="false"
                        IsNotNull="true"
                        Precision="15"
                        Scale="0"
                        Type="oracle.jbo.domain.Number"
                        ColumnType="VARCHAR2"
                        AliasName="CREDIT_REQUEST_ID"
                        Expression="CREDIT_REQUEST_ID"
                        SQLType="VARCHAR" >
                        <DesignTime>
                        <Attr Name="_OverrideAttr" Value="true" />
                        <Attr Name="_DisplaySize" Value="22" />
                        </DesignTime>
                        </ViewAttribute>

                        should be

                        <ViewAttribute
                        Name="CreditRequestId"
                        IsPersistent="false"
                        IsNotNull="true"
                        Precision="15"
                        Scale="0"
                        Type="oracle.jbo.domain.Number"
                        ColumnType="VARCHAR2"
                        AliasName="CREDIT_REQUEST_ID"
                        Expression="CREDIT_REQUEST_ID"
                        SQLType="NUMERIC" >
                        <DesignTime>
                        <Attr Name="_OverrideAttr" Value="true" />
                        <Attr Name="_DisplaySize" Value="22" />
                        </DesignTime>
                        </ViewAttribute>

                        I made a correction in *VO.xml file manually and it worked fine.

                        Please check your *VO.xml and if there inconsistency of Type and SQLType in ViewAttributes correct it manually. Check all your attributes. Same problem may be with Date and String data type.

                        Regards,
                        Marcin
                        • 9. Re: table cannot be sorted because it has pending changes which would be lost
                          Siva Prasad Nidimamidi
                          Hi,

                          Vo.xml is good. could tell me any other idea?

                          --siva                                                                                                                                                                                                   
                          • 10. Re: table cannot be sorted because it has pending changes which would be lost
                            DilipG
                            Hi Shiva,

                            By default, when the selector item is checked in a table that supports table selection, the underlying view
                            object attribute value is updated. This action leaves the view object with pending changes (even for a view-only
                            table). When the view object is in this state, table sorting is disabled.

                            If you need the ability to sort the table
                            under like these circumstances, follow below steps:

                            Step 1: Define a transient view attribute for the selector item using the BC4J view object wizard in JDeveloper.
                            Do not add a dynamic attribute by calling ViewObject.addDynamicAttribute.

                            Step 2: If you want the transient attribute value for the selector item to persist after sorting, define the transient
                            attribute at the entity object level instead of at the view object level.

                            Step 3: Following the OA Framework coding standards, you should always generate an OAViewRowImpl for
                            each view object so you can call named accessors. In this case, override your set<AttributeName> method as

                            shown below:
                            public void setSelectFlag(String val)
                            {
                            populateAttribute(SELECTFLAG, val);
                            }

                            This example assumes the selector's view attribute is named "SelectFlag," and the code is calling the
                            populateAttribute method to set its value without marking the view object as being "dirty."

                            Thanks,
                            Dilip
                            • 11. Re: table cannot be sorted because it has pending changes which would be lost
                              Siva Prasad Nidimamidi
                              Dilip,

                              Thanks for your reply.

                              my problem is not with selector ,but with the column sorting.

                              as i said im adding two columns through personalization and setting sorting property as YES.

                              when i clink on column for sorting then its throwing a warning.

                              --siva                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                              • 12. Re: table cannot be sorted because it has pending changes which would be lost
                                DilipG
                                Hi Shiva,

                                That code is for reference only. please apply that for Your view Attributes.

                                Thanks,
                                Dilip