Skip to Content
author's profile photo Former Member
Former Member

TableView: Filter as Dropdown

Hi @all

Has someone experiences with rendering the filter-row in an TableView? I get the access to the "data-rows" and i am able to render them, but how to get access to the filter row and create a "dropdown-Filter".

I want to create a functionality which is know from Excel: Autofilter!

Thank you for helping on this

Thorsten

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jan 26, 2005 at 02:01 PM

    As promised, here is my example (using MVC):

    In DO_REQUEST, I call a model method to create my filter table, because the content in my table is changing all the time, I need my filter to be up to date as well.

    Example: LASTNAME as column name for the filter

    data: lt_filter      type tableviewfiltertab,
          lv_last_insert type string,
    ...
    * here go your table and table structure definitions
    * lt_tvdata type ...
    * ls_tvdata type ...
    ....
    field-symbols: <filter> like line of lt_filter,
                   <wa>     type ihttpnvp2.
    
      append initial line to lt_filter assigning <filter>.
      <filter>-columnname = 'LASTNAME'.
    * define a pre-selection
      <filter>-selection  = '*'.
    * append filter lines:
    * first a joker character
      append initial line to <filter>-dropdownlistbox_table assigning <wa>.
      <wa>-name  = '*'.
      <wa>-value = '*'.
    * ... and now the tableview table entries
    * lt_tvdata is a copy of the table for the tableview
    * sort table
      sort lt_tvdata ascending by 'LASTNAME'.
    * now do the loop ...
      clear lv_last_insert.
      loop at lt_tvdata into ls_tvdata.
    *   if not in filter already ...
        if lv_last_insert is initial or lv_last_insert ne ls_tvdata-lastname.
    *     then append the value
          append initial line to <filter>-dropdownlistbox_table assigning <wa>.
          <wa>-value  = ls_tvdata-lastname.
          <wa>-name   = ls_tvdata-lastname.
    *     set last insert
          lv_last_insert = ls_tvdata-lastname.
        endif.
      endloop.
      sort <filter>-dropdownlistbox_table by value.
    

    This should do for a quick example, all left to do is use the filter in your tableview:

    <htmlb:tableview
      id = ".....
    ...
      columnFilters = "<%= model->filter %>" />
    * filter table as model attribute in this case
    

    Well, I should turn this topic into a weblog, as I got another (slightly different) dropdown in my filter ...

    Hope you get your part going with this example for a start.

    Max

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 27, 2005 at 07:23 AM

    Hi Max,

    thank you for your help on this. It works.

    Thank also to Brian McKellar, for his Weblog(BSP Trouble Shooting: Getting Help):

    /people/brian.mckellar/blog/2004/06/11/bsp-trouble-shooting-getting-help

    There you will find a really helpfull sample program: SBSPEXT_TABLE.

    Reading the documentation carefully could sometimes help!! 😊

    Thorsten

    Message was edited by: Thorsten Blechinger

    Message was edited by: Thorsten Blechinger

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.