on 02-08-2012 7:44 AM
Hi experts,
How to set particular column or cell color of result view in CRM WEB UI using IF_HTMLB_TABLEVIEW_ITERATOR interface ?
Is there any solution ?.
Regards,
Vishal
Hi Vishal,
I also have the same problem. In my thread [http://forums.sdn.sap.com/thread.jspa?threadID=2128064&tstart=0|http://forums.sdn.sap.com/thread.jspa?threadID=2128064&tstart=0], I described the steps I've done, I believe it's more detailed than yours, but seems no one is interested in it, as I'm new to WEBUI, I think maybe I'm wrong because guys around me kept telling me that SAP CRM WEBUI is not a web page, we need to focus on business, not just the layout, so I finally had to give up.
Luckly to see that your thread has some replies, it gives me the hope to solve that problem:). So if you get the solution, please have a post. Thank you very much!
Best Regards,
Jeff
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All.
Some time ago I dug in this topic too.
And what I found out is:
Table view iterator (represented by the class which implements IF_HTMLB_TABLEVIEW_ITERATOR interface) has parameters in method RENDER_CELL_START:
Exporting
P_REPLACEMENT_BEE
Changing
P_STYLE
P_CLASS
P_ISREADONLY
P_ISHIERCELL
So far so good. But if you use chtmlb:configTable or chtmlb:configCellerator or thtmlb:cellerator (in fact first two BSP elements finish their way with thtmlb:cellerator) the call stack will be:
RENDER_CELL_START from your iterator
RENDER_CELL_START from CL_CHTMLB_CONFIG_TABLE (for chtmlb:configTable) or CL_CHTMLB_CONFIG_CELLERATOR (for chtmlb:configCellerator)
GET_CELL_CONTENT from CL_THTMLB_CELLERATOR
And the reason is in this last method. Because it doesn't receive any changing parameters from iterator. Only replacement bee.
ITERATOR->RENDER_CELL_START(
EXPORTING
P_TABLEVIEW_ID = ME->ID
P_CELL_ID = LV_CELL_ID
P_CELL_BINDING = LV_CELL_BINDING
P_ROW_INDEX = IV_ROW_INDEX
P_ROW_KEY = IV_ROW_KEY
P_COLUMN_INDEX = IV_COLUMN_INDEX
P_COLUMN_KEY = IS_COLUMN_DEFINITION-NAME
P_ROW_DATA_REF = IV_ROW_DATA_REF
P_EDIT_MODE = IV_EDIT_MODE
IMPORTING
P_REPLACEMENT_BEE = LV_BEE
).
So P_STYLE and others are not taken into account.
The option probably is to use own BSP element which has style attribute itself, create it in RENDER_CELL_START of own iterator and return it as P_REPLACEMENT_BEE. Never tried it myself.
BTW, It seems that tree's stack of tags (chtmlb:configTree, thtmlb:tree) and general table tag thtmlb:tableView work with these parameter as expected. You can try it by yourself or just take a look into element handler classes of this tags and find a call of RENDER_CELL_START of iterator.
Hope this will help you!
Hi liu jinghui,
I am doing same way as you have given link, but In my case I am able to edit the column or read the column or put the value into column but I am not able to put the colour into column, Because P_STYLE parameter is optional, and I am putting the value into P_STYLE, but it is not reflecting .
Regards,
Vishal.
Vishal,
please read my answer above (exactly this message: http://forums.sdn.sap.com/message.jspa?messageID=11127647#11127647)
You set P_STYLE in your iterator.
It is transfered to CL_CHTMLB_CONFIG_TABLE or CL_CHTMLB_CONFIG_CELLERATOR (depends on which tag you use).
Then it is transfered to CL_THTMLB_CELLERATOR.
But CL_THTMLB_CELLERATOR doesn't take it. It only takes P_REPLACEMENT_BEE as you can see in the code above.
Hi Andrei,
Thank you very much for the post. Do you mean the sequence of method RENDER_CELL_START is first my own iterator then CL_CHTMLB_CONFIG_TABLE and finally CL_THTMLB_CELLERATOR and thus the latter CL_THTMLB_CELLERATOR will ignore the previous P_STYLE parameter value?
If that's your mean, I don't think it's the truth, I did a debug and found the sequence is first CL_THTMLB_CELLERATOR then CL_CHTMLB_CONFIG_TABLE and finally my own iterator, so it should work.
At present, I do not want to use alternative ways like BSP page or some other tags as you mentioned.
Please clarify if I'm wrong.
plus:
I also tried P_REPLACEMENT_BEE as you mentioned but failed.
Thank you very much!
Regards,
Jeff
Edited by: liu jinghui on Feb 29, 2012 11:40 AM
Jeff,
I mean exactly what I've said.
As far as we are talking about changing (e.g. returning) parameters we need to check not how you get to your iterator. Instead we need to check the calling back sequence from your iterator because we're wondering how this parameters are returned to top calling instance. And it is as I've said:
your iterator -> CL_CHTMLB_CONFIG_TABLE -> CL_THTMLB_CELLERATOR
Just debug father after your code in iterator. Where do you go after ENDMETHOD statement of your RENDER_CELL_START method in iterator?
Hi Andrei,
I did it as you adviced, yes, after my iterator, it comes back to CL_CHTMLB_CONFIG_TABLE and then CL_THTMLB_CELLERATOR. So I got your mean why P_STYLE not work.
But still to my supprise, why P_REPLACEMENT_BEE also not work? I use the statement
concatenate '<font color=""red"">' WF_TEXT '</font>' into html_str.
create object html_bee.
html_bee->add( html = html_str ).
p_replacement_bee = html_bee.
and I can see thru debug that p_replacement_bee does transfer to method GET_CELL_CONTENT in CL_THTMLB_CELLERATOR, in the line #258 in GET_CELL_CONTENT, LV_HTML is set as I expected. But after the method, everything remains unchange. So strange.
Do you have the same issue?
Jeff
Hi Vishal,
I finally found a solution how to set color for cells. Actually, I was very close to the success, but I wrote wrong BEE code.
You can refer my previous mentioned thread [http://forums.sdn.sap.com/thread.jspa?threadID=2128064&tstart=0|http://forums.sdn.sap.com/thread.jspa?threadID=2128064&tstart=0]
There I remarked the P_REPLACEMENT_BEE
* concatenate '<font color="" red"">'
* WF_TEXT '</font>' into html_str.
* create object html_bee.
* html_bee->add( html = html_str ).
* p_replacement_bee = html_bee. "not work either
because I tried and it did not work, so I thought I was using wrong method. You can just unmark the upper codes and remove the duplicated quote around the font color "red" and make it become: concatenate '<font color="red">' WF_TEXT '</font>' into html_str. If you want to set background color, you can embedded some HTML code like <span style="background-color:#00FF00">...</span>. Than it will work. I already can enjoy the beautiful colors now:).
Thank Andrei greatly for the discovery!!! You know I have struggled on it for weeks, today is really an exciting day!
Jeff
Edited by: liu jinghui on Feb 29, 2012 4:51 PM
Hi Vishal,
I have the same requirement , change the row color according to status.
Plz have a look the same issue.
http://scn.sap.com/thread/3479317
Thanks and regards
Alok
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, I am sorry but what kind of type the variable WF_TEXT has? What kind of values could be included as an example?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Oliver,
Thanks for your interest. Actually the variable WF_TEXT will contains the field's value (just for condition to color the field value).
Please refer the below code for your reference. Please feel free to query.
Example: Suppose we have a column 'CREATED_BY' in table view and when this field will have the value 'SAPUSER' then color it.
CASE p_column_key.
WHEN 'CREATED_BY'. "// Field name
READ TABLE me->gt_result INTO ls_order INDEX p_row_index.
IF sy-subrc NE 0.
EXIT."===========>>>
ENDIF.
ASSIGN COMPONENT p_column_key OF STRUCTURE ls_order TO <col>.
IF sy-subrc = 0.
wf_text = <col>.
ENDIF.
IF wf_text = 'SAPUSER'. "// If specific field Value found, then color it
CONCATENATE '<font color="red">' wf_text '</font>' INTO html_str. "//Setting red color for column text
CREATE OBJECT html_bee.
html_bee->add( html = html_str ).
p_replacement_bee = html_bee.
ENDIF.
ENDCASE.
Regards,
Vishal.
Hi Vishal,
thank you it works now. I was able to set the font colour to red. But could you maybe tell me please how to set the background color for the entire cell to red?
I have opened the thread:
http://scn.sap.com/thread/3411004
for this.
Thank you,
Hi Leon,
Thanks for reply,
I am doing but not able to color a cell can you help me please?
Regards,
Vishal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vishal,
You need to modify the changing parameter P_STYLE in the corresponding method.
Get the parameter and modify it by adding the color information. Once modified
the style info looks something like 'padding-left:4px;padding-top:2px;padding-right:2px;background-color:#efefef'.
You can find the corresponding column with the importing parameters, P_COLUMN_INDEX , P_COLUMN_KEY.
Regards,
Leon
Hi Leon,
I am doing like this:
method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
data: V_PROMPT type STRING.
case P_COLUMN_KEY.
when 'CATEGORY'.
if P_EDIT_MODE is not initial.
data: WORK_ORDER type STRING.
**********************************************************************
call method CL_HTMLB_INPUTFIELD=>FACTORY
exporting
CELLVALUE = 'TRUE'
DESIGN = 'STANDARD'
ID = P_CELL_ID
STYLE = 'celldesign:CRITICALVALUE_DARK'
receiving
ELEMENT = P_REPLACEMENT_BEE.
**********************************************************************
P_STYLE = 'celldesign:POSITIVE'.
endif.
endcase.
endmethod.
<%@page language="abap" %>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%@extension name="chtmlb" prefix="chtmlb" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<%
data lr_it type ref to ZCL_HTML_ITERATOR. "this class is implementing IF_HTMLB_TABLEVIEW_ITERATOR
create object lr_it.
%>
<chtmlb:configTable actionsMaxInRow = "6"
iterator = "<%= lr_it %>"
allRowsEditable = "TRUE"
id = "Table1"
onRowSelection = "select"
personalizable = "TRUE"
selectedRowIndex = "<%= Result->SELECTED_INDEX %>"
selectedRowIndexTable = "<%= Result->SELECTION_TAB %>"
selectionMode = "<%= Result->SELECTION_MODE %>"
table = "//Result/Table"
usage = "EDITLIST"
visibleFirstRow = "<%= Result->VISIBLE_FIRST_ROW_INDEX %>"
visibleRowCount = "6"
actions = "<%= controller->gt_button %>"
width = "100%"
xml = "<%= controller->configuration_descr->get_config_data( ) %>"
enableTableGraphics = "TRUE" />
What is the problem in my code?
Regards,
Vishal.
Hi Vishal,
Yes, you can achieve that by implementing the method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START
of the corresponding interface.
Regards,
Leon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.