cancel
Showing results for 
Search instead for 
Did you mean: 

Tableview : Display row in italics/Red

Former Member
0 Kudos

Hi Experts,

I have a requirement in which i have a tableview displaying Opportunity Result View in my Zcomponent, and we want to display a particular row in that tableview in Italics/Red/Bold depending upon some particular type of opportunity.

Plz guide me on how to proceed with this. It would be of great help if some sample code can be put here. Do we have to use concept of iterator/CSS for the same?

I am using following code to display my tableview:


<chtmlb:tableExtension tableId = "ResultList"
                       layout  = "FIXED" >
  <chtmlb:configTable xml                   = "<%= lv_xml %>"
                      id                    = "Table"
                      navigationMode        = "BYPAGE"
                      onRowSelection        = "select"
                      table                 = "//Result/Table"
                      width                 = "100%"
                      hasLeadSelection      = "TRUE"
                      visibleRowCount       = "<%= lv_lines %>"
                      actions               = "<%= controller->gt_button %>"
                      actionsMaxInRow       = "4"
                      selectionMode         = "<%= Result->SELECTION_MODE %>"
                      selectedRowIndexTable = "<%= Result->SELECTION_TAB %>"
                      selectedRowIndex      = "<%= Result->SELECTED_INDEX %>"
                      visibleFirstRow       = "<%= Result->visible_first_row_index %>"
                      showNoMatchText       =  "FALSE"/>
</chtmlb:tableExtension>

Regards,

Rohit

Accepted Solutions (1)

Accepted Solutions (1)

CarstenKasper
Active Contributor
0 Kudos

Hello,

you are right. You need to use an iterator.

Implement interface IF_HTMLB_TABLE_VIEW_ITERATOR in one of your classes (context node or view cotroller) and specify the attribtue: ITERATOR in the tableView tag.

cheers Carsten

Former Member
0 Kudos

Hi Carsten,

Just one doubt-even if we somehow manage to get the row, how will we set it to bold or italic?

Thanks and Regards,

Rohit

Answers (5)

Answers (5)

former_member267851
Participant
0 Kudos

Hi Rohit,

I have also same issue.

Plz check this thread.

http://scn.sap.com/thread/3479317

CarstenKasper
Active Contributor
0 Kudos

Hi Rohit,

it is true that you should be using an HTMLB tag for rendering. the LINK class is the most suitable. As for all I know it renders the link according to the linkType you specify. It is either DEFAULT, FUNCTION, REPORTING, RESULT, DRAGRELATE. See the BSP Tag Library in SE80 for details.

What could be a possibility is that the tags work on CSS style sheets. Maybe you can specify the correct style around the tag.

Meaning: use the BEE table tag you used before.

First put the CSS in there that is used by the LINK tag. Second insert the LINK tag.

Another possibility is to create a copy of the LINK tag classes and adjust them to render the link as you desire. Then in the iterator return the tag you created.

cheers Carsten

Former Member
0 Kudos

Hi Carsten,

Finally i achieved it using CL_HTMLB_LINK instead of CL_THTMLB_LINK!!!

Really thankful for your suggestions and pointers.

But, i could not fully understand how to go about using CSS and thtmlb for the same.

It will be great if you could put up some example or sample code, have gone though a few tags in SE80, but could not quite get what i want.

Thanks again for your valuable inputs.

Regards,

Rohit

Former Member
0 Kudos

No Replies!!!

Well, after much debugging, i am seeing that the text returned for my navigation link is of the class type CL_THTMLB_LINK, which does not have any attribute of color, and if i pass this line to its text attribute of factor method, it doesnt work, instead it comes as text in output:


concatenate '<font color="RED"><i>' col_img_str '</i></font>' into  col_img_str .

p_replacement_bee = CL_THTMLB_LINK=>factory(
                            id        = p_cell_id
                            text     = col_img_str
                         ON CLICK = 'opdetail'  ).

 

whereas the similar code work if i use this code:


p_replacement_bee = cl_htmlb_textview=>factory(
                            id        = p_cell_id
                            text     = col_img_str ).

but the problem is that htmlb class does not have ONCLICK attribute necessary for navigation, so does that mean that we can not change font properties of navigation link text????

Please help.

Regards,

Rohit

Edited by: Rohit Khetarpal on Nov 5, 2008 1:38 PM

Edited by: Rohit Khetarpal on Nov 5, 2008 1:39 PM

CarstenKasper
Active Contributor
0 Kudos

Hi Rohit,

as said: Implement the interface.

There is a method RENDER_CELL_START in it. Here you can set what the content of each and every cell should be and what it should look like.

You could for instance use the <htmlb:textView> tag to view a text. I once used a tag that allowed me to put a whole table or any kind of html into a table cell, do not remember the name right not.

Maybe if you did a where used list on the interface I gave you, you would have had a look at this example: CL_BT120H_C_TASKLISTOV_IT.

cheers Carsten

Former Member
0 Kudos

Hi Carsten,

Thanks for giving pointers.

I tried the example you mentioned, and also few other examples. What i got is they are adding some image (like Green Icon) in front of a field in tableview or making some field checkbox/dropdown.

But i did not get any example where i can change the font of the existing entry in a tableview without changing its properties (like navigation).

I can use following code to change it:


ASSIGN COMPONENT p_column_key OF STRUCTURE <fs> TO <l_field>.
      wf_text = <l_field> .
concatenate '<font color="RED">' wf_text '</font>' into  wf_text .
 
p_replacement_bee = cl_htmlb_textview=>factory(
                            id        = p_cell_id
                            text     = wf_text  ).  

but it will remove its property of navigation, and only text will come.

and i can use:

      CREATE OBJECT bee_hive.
      bee_hive->add_bee( bee = col_img ).
      bee_hive->add_bee( bee = config_content ).

      p_replacement_bee = bee_hive.

to add anything in front of my text.

Please guide how to change the font of existing entry of tableview, i am completely stuck.

Regards,

Rohit Khetarpal

Edited by: Rohit Khetarpal on Nov 4, 2008 4:05 PM

Former Member
0 Kudos

Hi Rohit,

I don't think it will be possible though html code. Because you dont have any tag in table to change the font color or style. You can do the same on other field you create using html code but not on table.

Again my understanding can be limited because there is nothing impossible in SAP ). Good luck.

Best regards

Pankaj Kumar