on 03-14-2014 9:20 AM
HELLO
I HAVE A REQUIREMENT WHERE THE FIRST ROW OF A TABLE SHOULD BE IN BOLD
basically the fiels are EBELP and mat_desc.
and this is what i see when i When i point to my data row in the heararchy
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA::ready:form - (JavaScript, client)
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP::ready:form - (JavaScript, client)
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC::ready:form - (JavaScript, client)
As i dont know too much on script , if somebody can help me that would be great
thanks a lot.
Hello Tahar,
You can achieve this using 2 methods:
1) Using a Global variable in the Layout.
For the First time, this global variable will be blank. If blank, then Set all the fields of a row to "Bold" and set this Global variable to "X". Now the same code will be triggered for next row. So this time, the fields will not be set to Bold because the Global variable is set. Write the below Javascript code on the Initialize event of DATA sub form as shown below.
if ( data.global_var == " " )
{
this.EBELP.font.weight = "bold";
this.MAT_DESC.font.weight = "bold";
data.global_var = "X";
}
So for next row, the font will not be bold because the Global variable is already set to "X"
2) Using a new Column in the table.
You can create one column in the table called Flag and in ABAP in Form Interface or Driver Program set this column to "X" only in 1st record. Set both the fields to bold only when the Flag column has the value "X". In Layout hide this Flag field. Write the below Javascript code on the Initialize event of DATA sub form as shown below.
if ( this.flag.rawvalue == "X" )
{
this.EBELP.font.weight = "bold";
this.MAT_DESC.font.weight = "bold";
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Tahar,
I have tested the 1st method and it works good. Just a small change you need to make from my 1st reply.
Set the Default Value of Global variable to "X" rather than keeping it space. You can set the default value to "X" as shown below.
The Default value (space) works inconsistently in Javascript. Sometimes isNull will work, sometimes == " " will work. Sometimes both doesn't work.
So instead of checking the Default value as space, check whether the Default value is "X".
For the First time, this global variable will be "X". If "X", then Set all the fields of a row to "Bold" and then immediately set the Global variable to space i.e " ". Now the same code will get triggered for the next row. So this time, the fields will not be set to Bold because the Global variable already set to space in 1st row and the IF condition will fail here. This will repeat for rest of the records. Write the below Javascript code on the Initialize event of DATA sub form as shown below.
if ( data.global_var.rawvalue == "X" )
{
this.EBELP.font.weight = "bold";
this.MAT_DESC.font.weight = "bold";
data.global_var.rawvalue = " ";
}
By doing this, only 1st row will be bold as shown below in the sample form. Only first row is bold as shown below.
Hello
Actually i changed the logic it is only if ebelp it is not blank that the line is bold wich will not require q variable definition.
So I put this codfe whih is your code but modified but still not working ??
in initialization i put the following
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC::initialize - (JavaScript, client)
if ( data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP != " " )
{
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.font.weight = "bold";
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC.font.weight = "bold";
}
see attached
it is still not working i dont know what is missing ?
I even logged off and on to be sure the changes were taken in consideration .
if (data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.rawValue != " " )
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.font.weight = "bold";
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC.font.weight = "bold"; }
Hello Tahar,
I think open flower bracket is missing in above code.
Can you please whether it is the same problem. check the syntax on the Javascript where you have written.
Click on the syntax check button highlighted in red above. If there is error, the line with the error will be highlighted.
You can check the error description by clicking on the Palettes button highlighted in blue above. In that select Report button. Let me know if you are getting the error or not.
no it is my cut and paste that did not workproperly, i tested as you said and have no red lines
if (data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.rawValue != " " )
{
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP.font.weight = "bold";
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.MAT_DESC.font.weight = "bold"; }
Hello Tahar,
I found out what the problem is. There were 2 major problems.
1) The condition != " "
2) Traversal of node from data.*
- To solve the 1st problem, you should use
if ( ! this.EBELP.rawValue.isNull ) instead of
if ( this.EBELP.rawValue != " " )
- To solve the 2nd problem, write the Java script code on Initialize event directly on DATA sub form as highlighted in the arrow below.
Delete the previous code which was not working. Write the code as below.
if ( ! this.EBELP.rawValue.isNull )
{
this.EBELP.font.weight = "bold";
this.MAT_DESC.font.weight = "bold";
}
I have tested it in a test form and it works fine. Find the results below.
Only the 1st, 3rd and 5th rows are Bold because ID field is filled only in these rows.
2nd and 5th row is normal since the ID field is empty here.
Select the fields EBELP and mat_desc and from the field format select "plain text".
then go to the paragraph format and select "B" for that particular fields("EBELP and mat_desc").
---
Naveen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this will let all the lines bold i just want the first line only on bold i know how to do this
i already gave exacty what i have in my script now
data.page2.Sous-formulaire2.ZTMM_EKPO.DATA.EBELP::ready:form - (JavaScript, client)
and i wanna put something like
if data.page2.Sous-formulaire2.ZTMM_EKPO.DATA(1).EBELP then put cell to bold
did you achieve your requirement by following the below??
if data.page2.Sous-formulaire2.ZTMM_EKPO.DATA(1).EBELP then put cell to bold.
If your requirement is not achieved then separate the 1st line from the table and implement:
Select the fields EBELP and mat_desc and from the field format select "plain text".
then go to the paragraph format and select "B" for that particular fields("EBELP and mat_desc").
--
Naveen
hi Tahar Yacoub
you can achieve this by javascript code
here is my hierarchy
write this code on initialize event of Row1
Cell1.font.weight = "bold";
Cell2.font.weight = "bold";
hope it will work
regards
Jitendra.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Tahar Yacoub
write this javascript code on initialize event of DATA
xfa.resolveNodes("DATA[*].EBELP[0]").item(0).font.weight = "bold";
xfa.resolveNodes("DATA[*].MAT_DESC[0]").item(0).font.weight = "bold";
hope it will work
regards Jitendra
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.