Reset sorting in TableEnhanced

  • Jan Schroeder
        Has successfully completed the online course Intermediate (200)
        Has successfully completed the online course Advanced (300)
        Has successfully completed the online course Basics (100)
        Has successfully completed the online course Advanced (310)
        Has successfully completed the online course Advanced (320)
      1 year ago #40111

      Hello Simplifier experts,

      In my application I use a TableEnhanced Widget where the elements are bound via the output of an SSBO.

      By default, TableEnhanced allows you to sort a column by clicking on the column name. That’s fine. But I don’t want the table to “remember” the last sort.

      Is there a way to reset the sorting of the entire table, i.e. all columns, using a script?

      Best regards
      Jan Schroeder

      • This topic was modified 1 year ago by Jan Schroeder.
      Andreas Dallner
          Has successfully completed the online course Introduction
          Has successfully completed the online course Intermediate (200)
          Has successfully completed the online course Advanced (300)
          Has successfully completed the online course Basics (100)
          Has successfully completed the online course Advanced (310)
          Has successfully completed the online course Advanced (320)
          Has successfully completed the Intermediate Certification
          Has successfully completed the Advanced Certification
        1 year ago #40130
        Up
        2
        Down
        ::

        Hi Jan,

        if you also enable the sort button, this can easily be done by clicking the reset button.

        If you want it o achieve it automatically it is more stable to change the view settings binding data. Else view settings dialog binding might or will overwrite your changes with next rendering again.

        The other (maybe simpler) way is to get the intial settings via oData = this.getView().byId(“TABLE SID”).getTablePersonalizationSettings() on start and reload it each time you want to reset the view: this.getView().byId(“TABLE SID”).setTablePersonalizationSettings(oData).

        -> For that you can also use the properties getTablePersonalizationSettings and setTablePersonalizationSettings in UI Action or BO Mapping.

        Kind regards Andreas

        Jan Schroeder
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
            Has successfully completed the online course Advanced (310)
            Has successfully completed the online course Advanced (320)
          1 year ago #40128
          Up
          0
          Down
          ::

          Maybe I found a solution on my own.
          I’m happy about suggestions if this can be solved in a simpler/more generic way.

           

          sap.ui.getCore().byId(“Screen_Name–TableEnhanced_Name”).getBinding(“items”).sort(null)

           

          Afterwards I call the method setSortIndicator(null) for all columns.

          • This reply was modified 1 year ago by Jan Schroeder.
        Viewing 3 posts - 1 through 3 (of 3 total)

        You must be logged in to reply to this topic.