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

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

Similar Messages

  • TableView Filter doesnu00B4t work for added columns

    In my model I have a column type SPRAS with a language key, but I want to render the language text so in the iterator I added a new column (hiding the one with the lang key), and I fill this new column with the following code:
      DATA: lang_txt TYPE string.
      DATA: lang_key LIKE sy-langu.
      FIELD-SYMBOLS: <fs> LIKE model->client.
      ASSIGN p_row_data_ref->* TO <fs>.
      lang_key = <fs>-spras.
      SELECT SINGLE sptxt FROM t002t INTO lang_txt
           WHERE spras = sy-langu
           AND   sprsl = lang_key.
      p_replacement_bee = cl_htmlb_textview=>factory(
           id = p_cell_id
           text = lang_txt ).
    It works good, but the problem comes because filtering doesn´t work with this column.
    Adding a new column to the model would be a solution but I don´t like it very much, it´d be better to solve this problem here in a class associated with the view/rendering od the data instead of changing the model.
    Best Regards!
    Jonathan.

    You can't use a column for filtering which isn't acutally present in your table. With an iterator you only control/change the rendering of your tableview, but the table data stays the same. (Unless you change the data, which would make the iterator useless?) You can not filter values that are not present in your table.
    So, if you want to filter an iterator-changed column, make sure the column contains data to sort/filter, and also provide a way for the user to be able to use the filter (as it doesn't make much sense to enter a filter value when the displayed data does not correspond to the table data.
    Have a look at this thread, it describes how you can add a dropdown to your filter:
    TableView: Filter as Dropdown
    Now if you alter this dropdown generating code to use your descriptive text (that you use in your iterator for display in column) as dropdown display values, then you should have a working filter for your tableview.
    Max
    (goes off writing the weblog promised in the mentioned thread)

  • TableView- bug in dropdown-Filter?

    Hi @all,
    maybe i am wrong but is there a bug in the dropdownFilter-Functionality for TableView?
    Yesterday we installed SP49 since then my dropdown-filter doesnt filters. I check the sbspext_table ->tableviewfilter.bsp and here is the same behaviour.
    Has someone similar experiences?

    Hi Rainer,
    you are great! This solves my problem in 100%.
    By the way comes this system behaviour with SP49?
    I am pretty sure that <filter>-selection = "*" works in SP48.
    Thank you very much.
    Thorsten
    PS I tried to give you the points but i am not able to do that. There is no radiobutton, only the "solved it on my own"
    Message was edited by: Thorsten Blechinger

  • Images in Tableview Filter not showing as image

    I have 2 CRM 7.0 systems which act differently concerning Table Views in the WebUI.
    If for example the Activity Search Result List shows the Images for Due, Overdue and Not Due, they are displayed correctly in the TableView itself.
    But when i'm clicking on the column header to filter the values, i do not get the images shown, but the image path, e.g.
    img src="/SAP/BC/BSP/SAP/thtmlb_styles/sap_skins/default/images/1x1.gif"
    In the other CRM System, i get the Images in the Filter List.
    Both Systems are not modified at this point, does anyone know how to get it to work that the Images are shown instead of the HTML-Code?
    Many thanks,
    Tobias
    Edited by: Tobias Abb on Feb 24, 2010 10:29 AM
    Edited by: Tobias Abb on Feb 24, 2010 10:30 AM

    Hi Tobias,
    the issue was reported before and the note 1325346 should address this. Could you please make sure, that this note is properly installed in both systems? In addition, you should check to clear your browser cache.
    Best Regards,
    Michael

  • TableView - Filter more than one value in same column

    Hi folks,
    I faced a problem on <b>filtering a field more than one value</b>.
    Does it possible solution for us to bring out filtering function while user try to enter few values in the SAME filter field?
    Thank you.
    First, i need to clarify my exact problem.
    --> I have created one tableView with filter = "server". Then i want to allow my user to enter few filter values in same field column.
    Example 1:
    Before
    COL1 COL2 COL3 COL4
    l--II--
    l-filter1I--I--
    *filter1 = AAA, BBB
    AAA AAA AAA AAA
    BBB BBB BBB BBB
    CCC CCC CCC CCC
    DDD DDD DDD DDD
    EEE EEE EEE EEE
    After
    COL1 COL2 COL3 COL4
    l--II--
    l-filter1I--I--
    *filter1 = AAA, BBB
    AAA AAA AAA AAA
    BBB BBB BBB BBB
    Is that any good suggestions to solve my doubt?
    Message was edited by:
            GP Poh

    check out this work around. in this sample currency column supports multiple values and multiple values in the filter column should be enter with comma as separater.
    <u><b>page attribute:</b></u>
    filtertab     TYPE     RSELOPTION
    filter_wa     TYPE     RSDSSELOPT
    itab     TYPE     FLIGHTTAB
    <u><b>layout</b></u>
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content design="design2003" >
      <htmlb:page title=" " >
        <htmlb:form>
        <htmlb:textView id ="tex"
                        text = "Filter on Currency Column support multiple values, they can be entered with comma as separater like 'usd,DEM'"/>
          <htmlb:tableView id                  = "tv1"
                           design              = "ALTERNATING"
                           table               = "<%= itab %>"
                           filter              = "APPLICATION"
                           columnHeaderVisible = "true"
                           sort                = "SERVER" />
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    <u><b>oninitialization</b></u>
    select * from sflight into table itab where currency in filtertab .
    <u><b>oninputprocessing</b></u>
    * event handler for checking and processing user input and
    * for defining navigation
    DATA: table           TYPE REF TO cl_htmlb_tableview .
    DATA: tv_data TYPE REF TO cl_htmlb_event_tableview.
    DATA: filter_value TYPE string .
    DATA: fil_val TYPE STANDARD TABLE OF string ,
          fil_val_wa TYPE string .
    REFRESH filtertab .
    table ?= cl_htmlb_manager=>get_data( request = request
                                               name    = 'tableView'
                                               id      = 'tv1' ).
    IF table IS NOT INITIAL .
      tv_data = table->data .
      IF NOT tv_data IS INITIAL .
        CALL METHOD tv_data->get_row_filter_value
          EXPORTING
            column_index = 6
          RECEIVING
            value        = filter_value.
        IF NOT filter_value IS INITIAL .
          TRANSLATE filter_value TO UPPER CASE .
          REFRESH fil_val .
          SPLIT filter_value AT ',' INTO TABLE fil_val .
          CLEAR fil_val_wa .
          LOOP AT fil_val INTO fil_val_wa .
            filter_wa-sign = 'I' .
            filter_wa-option = 'EQ' .
            filter_wa-low = fil_val_wa .
            APPEND filter_wa TO filtertab .
          ENDLOOP .
        ELSE .
          REFRESH filtertab .
        ENDIF .
      ENDIF .
    ENDIF .
    Regards
    Raja

  • Customize autocomplete filter of DropDown

    Hi there,
    I'm currently working on a more complex autocomplete solution for a dropdown list.
    It's described in several sources that by enabling the "custom text entry" of the dropdown list, open it up on enter and do some filtering on exit, you have a simple autocompletion. This filters the items in the list such that only the items starting like the typed text are shown.
    In my case, I have an adressbook in the background and want the autocompletion to search in multiple fields. For example, having "John Doe" in the dropdown list, I want to match the filter not only on "Joh" (first letters of the display value) but also on "Doe" (first letters of the last name).
    For that I created a change event script that takes the typed string and fill the dropdown with the matching items. So far it's working fine.
    But sadly after my filter the build in filter seems to hook in and hides all items that are not starting with the custom text.
    Is there a way to disable this behaviour?
    I have tried several other solutions like put a text field in the foreground of the dropdown box and use this for text entry, but it moves to the background as soon as I focus on the dropdown, or using a text field and a floating list that is shown when needed but no scrollbars are shown unless you focus the list and then you can't type anymore, and so on.
    I would be glad if you can help me or tell me an idea that could work!
    Regards,
    Philipp

    Hello Philipp,
    I am also trying to work thru the same thing. Possibly we can get there together ...
    I am familiar with the "custom text entry" method, but that alone doesn' suffice.
    I am trying to tackle it without creating any extra text fields, etc, ... just use the drop-down list field itself.
    Right now I am reading in detail http://forums.adobe.com/message/2372156#2372156
    Seems like this is trying to tackle the same functionality you are looking for.
    I'll keep you posted if I find anything.
    Regards, Martin

  • Tableview Filter/Sort Always open a new window!

    Dear experts,
    I have came accross a weird problem. When user filter/sort function in a tableview, a new window always display automatically with the result. But the old page does not change accordingly. But when you use filter/sort function in the new window, it's fine.
    I think this may because my old window is a ModalDialog window. It was opened using "
    javascript:window.showModalDialog". When using filter/sort function, a real window rather than a dialogue appears with the correct result. But this is not what I wanted. I want to display the filter/sort result in the dialogue window, anything could solve this problem?
    Thanks in advance,
    Sinvaya

    The easiest way to open new windows in Finder, Safari and just about any other program in Mac OS X is to use the keyboard shortcut, 'Command' + 'n'

  • HTMLB: tableview filter problems

    Hi,
    We developed a BSP application in CRM Web_IC. Whenever user goes to this screen, it retrieves the results from SAP CRM table and lists the entries. We used htmlb:tableview with filter attribute set to 'SERVER'. The first row of the entry is used to filter the entries displayed based on wildcard search and redisplay the same.
    We noticed that all this handled by client side eventing (Java Script) and it works okay in our development and testing environment.
    But we got wierd results when it went for user testing. On some of the machines, the page looks refreshed but the list display does not change based on the search. We thought it might be caching problem so we tried with different IE settings, it looks okay for some time on one of the machines but the problem gets repeated after wards. The situation is we cannot afford intermittent problems.
    OS are win'2000 and XP and browser is IE 6 with sp1 and sp2. The problem is not consistent so none of the combinations actually suggested if the problem is related to one area.
    Has anyone experienced similar to above. Any ideas are welcome.
    Message was edited by: Raju Datla

    Thanks Rainer,
    Without making any changes, today majority of the users are did not encounter the problem. I could not check the browser server cache settings as the BSP is using MVC and these fields are missing.
    Thanks and Regards,
    Raju
    I lost how to add points. I remember there was a document on how to add points, which I could not get by search. Could you help me how I can award points to you.
    Sorry for that and Thanks
    Message was edited by: Raju Datla

  • ICWC htmlb:tableview filter problems

    Hi,
    We developed a BSP application in CRM Web_IC. Whenever user goes to this screen, it retrieves the results from SAP CRM table and lists the entries. We used htmlb:tableview with filter attribute set to 'SERVER'. The first row of the entry is used to filter the entries displayed based on wildcard search and redisplay the same.
    We noticed that all this handled by client side eventing (Java Script) and it works okay in our development and testing environment.
    But we got wierd results when it went for user testing. On some of the machines, the page looks refreshed but the list display does not change based on the search. We thought it might be caching problem so we tried with different IE settings, it looks okay for some time on one of the machines but the problem gets repeated after wards. The situation is we cannot afford intermittent problems.
    OS are win'2000 and XP and browser is IE 6 with sp1 and sp2. The problem is not consistent so none of the combinations actually suggested if the problem is related to one area.
    Has anyone experienced similar to above. Any ideas are welcome.

    Hi Sasi,
    Unfortunately I could not get any direct solution to the problem. I chased SAP OSS and SAP direct consultant who was working with us with no solution. Last time, I heard it was sent to htmlb team at SAP. I stopped chasing after that as project gone live and I fixed the problem by putting a search area and button using client side eventing. 
    If you read the source code once the page is displayed, you can see that SAP writes Javascript to handle the search. I copied the code as Javascript function and placed a button to fire this function which handles the filter as normally SAP does.
    Regards,
    Raju

  • Setting value incase of SERVER Tableview filter

    Hello
    I am having a tableview where there are around 15 columns each with filtering capability. Almost all columns can use SERVER level filter except one or two. In that case can we modify the value of the server filter in onInputProcessing i.e. i will get the filter value and modify the same to give correct results.
    Thanks in advance.
    Regards
    Tatvagna

    Look at the below link to get & modify the filter value..
    Re: reg modifying filter settings
    Let us know if you have an issue...
    <i>* Reward each useful answer</i>
    Raja T

  • Hbj TableView  (filter)

    HI all, I need to add the filter functionality to my table:
    <hbj:tableView 
          id="myTableView1"
          model= "ServiciosBean.modeloServ"
          design = "ALTERNATING"
             headerVisible = "true"
             footerVisible = "true"
          filter = "TRUE"                
          fillUpEmptyRows = "false"
          selectionMode = "SINGLESELECT"
          navigationMode = "BYPAGE"
          onNavigate = "onNavigate"
          visibleFirstRow = "<%= ServiciosBean.getVisibleRow()%>"
          visibleRowCount = "<%=  
    ServiciosBean.getVisibleRowCount()%>"      
          width="100%" >          
    </hbj:tableView>
    But setting the property filter is not working, as filter is not a property of the tag hbj.
    Anyone know how to implement this, in a jsp application?
    Thanks in advance!

    Please, help!

  • Tableview filter=application

    Hi,
    I want to use a tableview with filter type "application". How can I access the filter values the user has entered?
    thanks, Claudia

    I have found a solution to handle your case with javascripts.
    In your onManipulation event.
    use the following code to get the response string.
    and modify the string to add your javascript.
    CALL METHOD runtime->server->response->get_cdata
       RECEIVING
         data = test.
    *now the string test will have a line like this for each *of the filter fields.
    *<input class="sapEdfFltr" style="height:100%;" *name="<tableviewid>-filter_<column number>" value="" *onkeyDown="htmlbF('sldapt-filterEvt')">
    modify this line to add a javascript for onchange event and handle your data manipulation there.
    REPLACE ALL OCCURRENCES OF 'xxxxxxx' IN test WITH
    'xxxxx onchange="javascript:alert(this.value)"'.
    if sy-subrc eq 0 .
    runtime->server->response->set_cdata( test ).
    endif .
    hope this is clear.
    Regards
    Raja

  • TableView filter range

    Hi,
    I'm looking for the possibility to filter for a range (e.g. a date range) in an tableView.
    Is there already a possibility to do so in tableView?
    If not, how can I implement this feature?
    thanks a lot,
    Claudi

    Hallo Claudia,
    Not possible natively from tableView. What you can do is have some filter inputfields about your table somewhere. If values are entered, either delete (filter) rows from table before rendering, or use an interator to dynamcially filter. Look at the start_row method. It has a skip parameter which you can set to skip rows that does not match in the filter.

  • TableView Filter

    Hai,
    In my application I wanted to implement my own filters,
    Can one please tell me How can I Do that??
    The reason I wanted to Implement my own filter Is that, I am using a pager and I can not syncronise values in the pager with the Tableview if I set the FILTER to server.
    Regards,
    venkatesh

    Hai Raja,
    I am using a tableView.
    For navigation Instead of the tableView navigator I am using a pager.
    The problem I had in using the pager is,
    If I am using filter to filter the records in the tableView.I wanted to reflect the page count and present page in to the pager(After applying filter).
    But what is shown in my pager is the earlier values when no filter is applied.
    How can I make my pager to work exactly like a tableview navigator.
    Can any one please tell me if this is possible as I dont find any public attribute in the  class CL_HTMLB_TABLEVIEW and filterrowcount and filtertab are protected.
    Regards,
    Venkatesh
    Message was edited by: venkateshwarlu yelagandula

  • How to keep Internal table after filter in tableview?

    Hi, Im kinda new in BSP, Im an ABAP developer.
    I manage to get info from a SolMan to my internal table using submit importing from memory after clicking a search button and the table is filled.
    The thing is after I execute a filter on any field of the tableView my internal table is not FILTERED, I see the original internal table that I searched.
    I wanna know how can I get the filtered table so if I make a Download to Excel button I want to download the table that Im seeing "filtered" and not the original one.
    Thx
    Edited by: Rodrigo Ariel Giner de la Vega on May 8, 2008 4:41 PM

    Hi Roddy,
    you have probably figured out by now that the tableView filter option only filters which rows are displayed from the itab, is does not actually remove the filtered rows. This makes sense otherwise it would have to rebuilt the itab with each pass to ensure any previously filtered rows are returned if the filter is changed.
    What you can do it access the filter parameters in the OnInputProcessing method of your page. Essentially the HTTP request carries parameters as name/value pairs in either the HTTP header or as form fields. You can get to them like this..
    DATA:
          lt_ffields         TYPE tihttpnvp,
          lt_hfields         type tihttpnvp.
    request->get_header_fields( CHANGING fields = lt_hfields ).
    request->get_form_fields( CHANGING fields = lt_ffields ).
    Where the HTMLB event handling parameters are passed might depend on how you call the HTML form, so have a look in both areas for these parameters. I just did a simple test and they were in the form fields.
    So you can place a button on your screen to trigger your download to Excel and have it call the standard htmlb event processing routines.
    Then when you detect this button has been clicked in the OnInputProcessing method you can apply the tableView filters to the data before you send it to Excel.
    Cheers
    Graham Robbo

Maybe you are looking for

  • How do I delete iphone from a device when I no longer have the device

    I synced my phone to too many devices, some of which I don't have anymore, how can I delete them?

  • Old airport express advice...

    I would like to know why Apple have forced me to throw away a perfectly working Airport express (2005). They have chosen to not provide support. That is all there is wrong with it. The Utility says I have to use an older version of the utility. But t

  • Country specific Dep Area

    Hi All, If there are two depreciation areas say 01 and 10 and 01 dep. area is my Book Dep area and 10 dep area is my country dep area. So now when i run the dep posting, should the dep be posted to both the dep areas. I am aware of how to configure t

  • Printing a waveform chart

    i am trying to print a waveform chart and it prints but it does not display the data on the printed copy of the graph? here is my VI Harold Timmis [email protected] Orlando,Fl *Kudos always welcome Solved! Go to Solution. Attachments: test1.vi ‏269 K

  • Install GRC AC 5.3 RTAl in a backend system. (VIRSA) up on VIRSA 400_700

    Hi Supports, I want to install GRC AC 5.3 RTAl in a backend system. (VIRSA) Where we have below setups already. We have a NW 2004 server with GRC 5.3 Installed and SLD is configured. Now we need to install GRC AC 5.3  RTA in Backend systems, so that