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
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
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