cancel
Showing results for 
Search instead for 
Did you mean: 

Modifiying Column in ITERATOR to include image?

Former Member
0 Kudos

I've been playing around with this all morning, I have an Iterator for my tableView and I would like to add a refresh image to one of the column headers.

What I have been trying to use the DISPLAY_BEE property of the columndefintion

In the "IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS" here is what I'm trying.


DATA: colhead_bee TYPE REF TO CL_BSP_BEE_TABLE.
DATA: txt TYPE REF TO CL_HTMLB_TEXTVIEW.
DATA: image TYPE REF TO CL_HTMLB_IMAGE.

image = cl_htmlb_image=>factory( id = 'mnu_refresh'
			              src = '@42@'
			              alt = 'Refresh'
	              onClick = 'myConfirmAlert' ).
			
txt = cl_htmlb_textView=>FACTORY( text = 'Status' ).
			
CREATE OBJECT seats_bee.
colhead_bee->ADD( image ).
colhead_bee->ADD( txt ).

APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
  <def>-COLUMNNAME  = 'STATUS'.
  <def>-TITLE       = 'Status'.
  <def>-WIDTH       = '10%'.
  <def>-SORT       = 'X'.
  <def>-DISPLAY_BEE = colhead_bee.

But I get no error and no image, is it even possible and if so am I barking up the wrong tree?

I checked the SBSPEXT_TABLE example but I didn't see maybe I missed it where someone has done something similiar??

Accepted Solutions (0)

Answers (5)

Answers (5)

dmitry_sharshatkin
Active Participant
0 Kudos

Hello Craig,

I've met similar requirements and I could implement them via enhancing CL_THTMLB_CELLERATOR => GET_HEADER_BEES, where I change the ET_HEADER.

Need to note, i'm on SAPK-73105INWEBCUIF, CRM 7.0 EHP2.

One can see the code of the method and note down that BEEs and even Toltip do not play any role as they are redefined again.

My post may come to late, but I hope it will be useful for others.

former_member181879
Active Contributor
0 Kudos

In principle the display bee is used to render each cell the same for this column. It is not possible to custom render the header itself. (There are powers that does not want that:). Also looks slightly silly. Why not set a nice tooltip to just explain the icons.

rainer_liebisch
Contributor
0 Kudos

Hi Craig,

just believe Steffen, because he is the real tableview expert

in our group.

Regards,

Rainer

Former Member
0 Kudos

Hi Craig,

A while back, I tried it just like Brian's weblog on tableview iterator. Maybe that will help you.

Just an excerpt from his weblog, which is 'slightly' different than yours:


WHEN 'ICON'.
    DATA: icon_plane TYPE STRING.
    icon_plane = CL_BSP_MIMES=>SAP_ICON( id = 'ICON_WS_PLANE' ).
    p_replacement_bee = CL_HTMLB_IMAGE=>FACTORY( id = p_cell_id src = icon_plane ).

By the way, some weblog has very small font so it hard to read, tableview iterator and BEE are the one I found, maybe if Brian read this, he'll fix it for us TIA Brian

Regards,

Iwan

Former Member
0 Kudos

Thank Iwan, however the problem I have is that I'd like to modify the column header, the code excerpt is how you modify the content of the column itself.

For example in Brian's code when he comes the column called 'ICON' he enter's a the "image icon" as the value for the column. Which works perfectly, except I want the column header to show the icon as well.

I thought using the DISPLAY_BEE field for the column defintion was correct but I don't get the image only the text.

steffen_knoeller
Explorer
0 Kudos

Hi Craig,

You should see at least an image for each row on screen.

I've tried the following:


<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003">
  <htmlb:page>
    <htmlb:form>
      <%
        data iterator type ref to cl_sdn_iterator.
        create object iterator.
        
        data sflight TYPE FLIGHTTAB.
        select * from sflight into table sflight.        
      %>
      <htmlb:tableView id              = "test"
                       iterator        = "<%=iterator %>"
                       table           = "<%=sflight %>"
                       visibleRowCount = "8">
      </htmlb:tableView>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.

  DATA: colhead_bee TYPE REF TO CL_BSP_BEE_TABLE.
  DATA: txt TYPE REF TO CL_HTMLB_TEXTVIEW.
  DATA: image TYPE REF TO CL_HTMLB_IMAGE.
  field-symbols <def> like line of P_COLUMN_DEFINITIONS.

  image = cl_htmlb_image=>factory( id = 'mnu_refresh'
  			              src = '@42@'
  			              alt = 'Refresh'
  	              onClick = 'myConfirmAlert' ).
  			
  txt = cl_htmlb_textView=>FACTORY( text = 'Status' ).
  			
  CREATE OBJECT colhead_bee.
  colhead_bee->ADD( image ).
  colhead_bee->ADD( txt ).

  APPEND INITIAL LINE TO P_COLUMN_DEFINITIONS ASSIGNING <def>.
  <def>-COLUMNNAME  = 'STATUS'.
  <def>-TITLE       = 'Status'.
  <def>-WIDTH       = '10%'.
  <def>-SORT       = 'X'.
  <def>-DISPLAY_BEE = colhead_bee.

endmethod.

Unfortunately, in general, it isn't possible to manipulate the header - only cell content can be replaced by a bee.

Best wishes,

Steffen

Former Member
0 Kudos

Thanks Steffen,

That is what I was coming to the conclusion of is that the column header can't be modified. Be a nice feature for the future though. Techincally it can't be much different than the <def>-SORT = 'X' where the two small arrow images appear.

As for showing an image in each row, that is no problem at all.

Former Member
0 Kudos

I have been fighting, sorry playing around using Brian's weblog <a href="/people/brian.mckellar/blog/2003/10/30/bsp-programming-bsp-element-expressions-bees">BSP Programming: BSP Element Expressions (BEEs)</a>

The result - kaput!

Suggestions or was Steffen correct and this is just not possible?

former_member181879
Active Contributor
0 Kudos

> Suggestions or was Steffen correct and this is just

> not possible?

Steffen is the quiet guy in our team. But he is also THE expert for anything HTML or JavaScript. His knowledge exceeds mine by far! Anything that he writes is to be printed our and framed. It will be good.

former_member181879
Active Contributor
0 Kudos

> The result - kaput!

Ok, email me the source of the iterator class, and the data table you want to render. Simple example. I will fix it, and you can then append it here. This way we get some working examples of usage of iterators.

I never did publish the complete source for the iterators weblog (don't even know if I have it still). For new weblogs, I have now the possibility to link to .TXT file with all source. Should I do try to find and publish the complete code of weblog?

Former Member
0 Kudos

Oh - well Steffen nice to meet you 😆 and now that you are here.... OK I'll wait awhile before hammering you with questions

Brian, I'll email you the code from my Iterator.

former_member181879
Active Contributor
0 Kudos

> Oh - well Steffen nice to meet you 😆 and now that

> you are here....

He is not here! We only interrupt him in very special cases. As I said before, this guy is <b>the</b> real expert!

Former Member
0 Kudos

OK hint taken.

Former Member
0 Kudos

Well I got it!!! Maybe it was SP43 - ???

<a href="/people/sap.user72/blog/2004/08/27/bsp-howto-tableview-iterator--column-header-graphics">BSP / HOWTO: tableView Iterator - Column Header Graphics</a>

Former Member
0 Kudos

Hi Craig,

Try this:


    data:
      imgsrc type string value 'src="http://www.google.it/intl/it_it/images/logo.gif"',
      onclickcode type string value 'onClick="javascript:alert(''Test'');"'
    .
      <htmlb:tableView id              = "test"
                       table           = "<%=sflight %>"
                       visibleRowCount = "8">
          <htmlb:tableViewColumn columnName = "STATUS"
                                 sort       = "NONE"
                                 title      = "<img <%=imgsrc%> <%=onclickcode%>> Status" />
          <htmlb:tableViewColumn columnName = "FIELD1"
                                 sort       = "NONE"
                                 title      = "Field One" />
      </htmlb:tableView>

It is surely less flexible than your solution, but more simple.

Dany

Former Member
0 Kudos

Not bad Dany,

However doing it this way you tend to loose even more of the flexibilty of the Iterator.

Good job though!