Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
maximilian_schaufler
Active Contributor
0 Kudos

2005-12-14 - Important Update:
There has been a change in how the submitted filter values get handled between SP47 and SP54 (on WebAS 6.20), that's why there is a problem like Marcus mentioned in his comment. I posted one quick way to find a solution in the BSP forum: TableView Filter DropDown
Watch this thread for further updates on this topic.




This one lay around unfinished for quite a while now, but as I got asked a question lately where I would have liked to pointed to my weblog, it was about time to get it done.



Before we start with the main example, pay attention to these weblogs, they give you the basics for MVC structure and tableview iterators, which I’m gonna use here. I only want to focus on the filter part, so please consult these references for additional info:



thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators

BSP Programming: HTMLB TableView Iterator

BSP / HowTo: Exploring BSP Development with MVC</p>

Start with a tableview with filter ...

... and then add a DropDown in the Filter Row

-selection  = ''.<br /> append filter lines:-name  = ''.<br />  <wa>-value = ''.

That’s it, dropdown implemented – and hopefully working as well 🙂

Try it with some tables of your own, with less different values (that occur multiple times), play around a bit.

Use DropDown for iterator-manipulated column

For the second part of this weblog – maybe the language ISO code is not what you want in your tableview. And because you read some other weblogs (I hope you did) you use a tableview iterator to change the displayed text for your column. Replacing the code with the corresponding text from table T002T makes your data much more user-friendly.



METHOD if_htmlb_tableview_iterator~render_cell_start .

DATA: textview TYPE REF TO cl_htmlb_textview,
lv_language type string.

CASE p_column_key.

* -




WHEN 'LAISO'.

select sptxt from t002t
into lv_language
where spras = 'E'
and sprsl = row_data_ref->spras.
endselect.

textview = cl_htmlb_textview=>factory(
id = p_cell_id
text = lv_language ).
p_replacement_bee = textview.


* -




ENDCASE.

ENDMETHOD.



But you also have to alter the part for your filter dropdown generation, otherwise you will still have the code values in the dropdown – which is not what you want.

!https://weblogs.sdn.sap.com/weblogs/images/22606/Iterator-Filter-Dropdown-04.jpg|height=131|alt=imag...!

Summary

Remember that (automatic) tableview functions like sort and filter can only work with data that is present in the table. If you are using an iterator to change the displayed content, you might run into problems, as your filter is not working as it is supposed to anymore.



By providing a filter dropdown you not only offer a more convenient way to use the filter, but you can also take care of any iterator-made display changes – this way the user will not get tempted to enter filter values that actually won’t work.

4 Comments