Table Filter Option

Tagged:
  • Julia
    Participant
      5 years, 5 months ago #18695

      Hello everybody,

      is there a way to add filter and sort functions to the table columns?

      Thanks!
      Julia

      Mathieu Roll
      Keymaster
        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)
      5 years, 4 months ago #18898
      Up
      1
      Down
      ::

      Hello,

      please find attached an example application (ShoppingList).

      In the example i’m using the UI5 Model Filter.

      https://files.simplifier.io/f/1c6022bc7c8041be8862/?dl=1

      Chris Bouveret
      Keymaster
        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 (320)
        Has successfully completed the Intermediate Certification
        Has successfully completed the Advanced Certification
      5 years, 5 months ago #18696
      Up
      0
      Down
      ::

      Hi Julia,

      please refer to the UI5 Documentation of the Table Control

      Hope that helps
      Chris

      Julia
      Participant
        5 years, 5 months ago #18701
        Up
        0
        Down
        ::

        Hi Chris,

        thanks for the doc. I’ve seen this before. But I’m stuck with using this in the app.

        That type of table do I have to use? sap.ui.table.Table? sap.m.Table? Or another?

        I’ve seen with ui-Table there are options like enableCellFilter. Is this the enabling for this functions? (Although I’m hanging with getting my data in the table at the moment).

        How to use them?

        Thanks!
        Julia

        jonas.rausch
        Participant
          Has successfully completed the online course Introduction
          Has successfully completed the online course Intermediate (200)
          Has successfully completed the online course Advanced (300)
        5 years, 4 months ago #18706
        Up
        0
        Down
        ::

        Hi Julia,

         

        Since Ui5 Filters work on the Data Model of the corresponding Table, you can Filter any Table you want.

        I´d say the easiest Example would be the sap.m.Table.

        Unfortunately, the Filter Function needs to be added via script, there is no Simplifier Function for that yet.

         

        The First thing you need to do:

        create a new Filter: new sap.ui.model.Filter([key in model you want to filter(column)], [Filter function], [value you want to filter by])

        Second: Apply the Filter to the Model:

        [your model reference].filter([The new Filter]);

         

        I hope this helps.

         

        Julia
        Participant
          5 years, 4 months ago #18719
          Up
          0
          Down
          ::

          Hi Jonas,

          since I am still very new to the topic, could you give me an exact example of how to insert the filter?

          More precisely, I need several filters, since I have different columns.
          One is a filter that allows me to select all the possibilities that are in this column (texts/places) (with multiple selection).
          And a filter with which I can filter in a column with date-time data according to a time period in the column.
          I also have columns with checkboxes, for which a filter function would also be good, and numerical values (costs).

          I would like to equip all columns with filters? Is there any documentation on how to use and install these filters? Or do you / do you have examples for me?

          Thanks in advance for your help!
          Julia

          jonas.rausch
          Participant
            Has successfully completed the online course Introduction
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
          5 years, 4 months ago #18744
          Up
          0
          Down
          ::

          Unfortunately, I dont have any examples at hand, but you can take a look at the table Filtering example of the UI5 Documentation:

          https://sapui5.hana.ondemand.com/#/entity/sap.ui.table.Table/sample/sap.ui.table.sample.Filtering

          The Filter Part works for all model bound data, like tables and lists.

          The ui.table.table already has inputs for the filter values, but you can easily add the inputs to your app

           

          You can add Multiple Filters at once using a Filter Array:

          https://sapui5.hana.ondemand.com/#/api/sap.ui.model.Filter

           

          I hope this helps a bit, but dont worry if you cant get it to work on your first try, filters are on of the more complex things you can do with UI5

          Julia
          Participant
            5 years, 4 months ago #19003
            Up
            0
            Down
            ::

            Hello!

            Thank you very much! It works now! 🙂

            Two more question has arisen from this while implementing the filters for one column.

            In the selection list for the filter is now for every row value in the table on selection. So I have the same selection value ten times and more, for example if I want to filter for “notebook”, I have this selection for every notebook (over 10 times), and not just one selection for notebook.
            Can I somehow collapse the values?

            And, in my list I have check boxes. How can I filter check boxes? Or do you have another idea for handling true/false values in a table and SQLite database?

            Thank you very much!
            Julia

            jonas.rausch
            Participant
              Has successfully completed the online course Introduction
              Has successfully completed the online course Intermediate (200)
              Has successfully completed the online course Advanced (300)
            5 years, 4 months ago #19259
            Up
            0
            Down
            ::

            Hi Julia,

            Im not entirely certain what you mean with your first question. Could you maybe elaborate a bit further?

            In Regards to the second Question, Boolean values in sqlite are typically handled via Int values where 0=false and anything else means true.

            So in the model, you´ll have int representations of your boolean staats.

            The Checkbox´s selected property can be bound to that via an expression binding to these values.

            You can than simply filter for 0 and 1 in your model like you would with e.g. names

             

            hope this helps

             

          Viewing 9 posts - 1 through 9 (of 9 total)

          You must be logged in to reply to this topic.