0 votes

I need to identify each sumfield to apply rules depending on the group level.

In my custom view separated by kind of level, for each level I have to apply a modification depending some rules.

Probleme I'm not able to create an ID UNIQUE for each kind of "sumfield.MYFIELD"

<td class="sumfield text-end nowrap"><span id="IDUNIQUE_$FIELD$" class="toChange"><#F=$FIELD$;FORMAT=,0.00> &euro;</span>

In a classical TD I can use the #N or a Key but in the sumfield #N ou Key doesn't exist.
Is there any way to provide this unique ID in this kind of Grid definition ?

asked in Efficy/ Client side by (285 points)

2 Answers

0 votes
Best answer

INTO your GridColumnCustom.txt

First : you need to identify your group.
I chosen the <#HASH> because it prevent the <#F> bugs when your group name contains specials characters.

group{[<tr class="group" id="Group_<#HASH>" data-msg="group;<#ACTION>;<#HASH>"><td class="badge-cell"></td><td colspan="$COLUMNCOUNT$"><i class="i-<#ACTION>"></i><#F></td></tr>]}

Next identify your sumstartrow here a new class to identify them

sumstartrow.Xxxx {[
<tr class="text-start sumstartrow" >

Next : you must create a generic ID into your sum filed and stocking a varient

sumfield.TOTAL.Xxxx {[<td class="sumfield text-end nowrap bold"><span id="Total_$FIELD$_0" data-args="0" class="Total_to_be_colored"><#F=$FIELD$;FORMAT=,0.00></span></td>]}

INTO your override file after START commands
In my case I choose to override main/consult.js and I do this command for each of my identified groups

    if ($("#Group_MONHASH").length >0){ // test if group exist

// Then update the argument "data-args" for each identified class in this group             

//finally test if dom update is successful and for each attibut data i update the node id 
                if($('span[data-args^="2"]').length >0){
                    $('span[data-args^="2"]').each(function(index, obj) {
                        var Id = $(this).attr('id');
                        Id = Id.substring(0,Id.length-1); 


At least
when DOM is ready I updated all my following TD
BEFORE on grid loading

<td class="sumfield text-end nowrap bold"><span id="Total_$FIELD$_0" data-args="0" class="Total_to_be_colored"><#F=$FIELD$;FORMAT=,0.00></span></td>


  <td class="sumfield text-end nowrap bold"><span id="Total_MONTANT_1" data-args="1" class="Total_to_be_colored">30,00</span></td>
   <td class="sumfield text-end nowrap bold"><span id="Total_MONTANT_2" data-args="2" class="Total_to_be_colored">55,00</span></td>

Now I can identify each sum depending on his group and change color, recalculate something etc directly into your GridCmd.js file that you override over the requireConfig.js

Of course here it's little bit static because I known the groups and because its for a particular Vue. But I guess that this principe may be reused for a more dynamic override.

answered by (285 points)
0 votes

Hey what do you need your Unique ID for?

I did something in 2012 that was working fine but that could not help you depending what do you need an ID for :

there it is :

sumfield.C_POTENTIEL, sumfield.CA_MOIS, sumfield.OBJ_MOIS, sumfield.CA_CUM, sumfield.OBJ_CUM, sumfield.CAN1_MOIS, sumfield.CAN1_CUM [
<td id="IdTempToFormat" class="Grid" align="right">
        document.getElementById("IdTempToFormat").innerHTML = NL_amountToDisplay(<#F=$FIELD$; JSTEXT=true> / 1000, true);

Unfortunately if you need your ID for more than this scope it won't do the trick...

answered by (989 points)
i guess you can still use the tag :

... id ="prefix_<#F=$FIELD$; JSTEXT=true>" ...

and replace $Field$ by the K of your record... did you try this?
Hello all your solutions are not depending on my needs, because I need to have an UNIQUE ID to manipulate the DOM after load for each group.

Anyway I found a solution to do it.
1,247 questions
1,517 answers
328 users