Info window Summary Fields

142 views
Skip to first unread message

norber...@multimageweb.com

unread,
Nov 12, 2018, 5:32:44 AM11/12/18
to iDempiere
Hi,

does anybody implemented summary fields (e.g weight, total..etc.) - displayed in footer

norbert

Nicolas Micoud

unread,
Nov 12, 2018, 6:05:22 AM11/12/18
to iDempiere
Hi Norbert,
Not in footer, but directly on the column header.

Here's the code, if it can help (it does the sum of the selected lines for a specified column "Duration").
It is called from onEvent(Event event) method :
else if (event.getTarget() == contentPanel && event.getName().equals(Events.ON_SELECT)) {

}


String columnName = "Duration";
BigDecimal somme = Env.ZERO;
int idx = 0;

for (int i = 0; i < contentPanel.getColumnCount(); i++) { // Recherche du numéro de la colonne
   
if (p_layout[i].getGridField() != null && p_layout[i].getGridField().getColumnName().equals(columnName))
         idx
= i;
}

for (int rowIndex = 0; rowIndex < contentPanel.getModel().getRowCount(); rowIndex++){            
   
Integer keyCandidate = getColumnValue(rowIndex);

   
@SuppressWarnings("unchecked")
   
List<Object> candidateRecord = (List<Object>)contentPanel.getModel().get(rowIndex);

   
if (contentPanel.getModel().isSelected(candidateRecord)) {
     
if (!recordSelectedData.containsKey(keyCandidate))
           somme
= somme.add((BigDecimal) contentPanel.getValueAt(rowIndex, idx));
       
}
   
}    

for (Component h : contentPanel.getHeads())
       
((ListHeader) h.getChildren().get(idx)).setLabel("TOTAL " + somme);


Regards,

Nicolas

norber...@multimageweb.com

unread,
Nov 15, 2018, 2:53:07 AM11/15/18
to iDempiere
thanks Nicolas, we will trying to implement it, then will ask you. if any question. 
n

Murilo Habermann Torquato

unread,
Nov 24, 2018, 11:05:04 AM11/24/18
to iDempiere
Hi Norbert,


You will be able to define at info window definition if the column is sumarized:

Seleção_262.png


And then this will be the result:



Seleção_266.png

Or as an alternative (controlled with a sysconfig key):


Seleção_268.png

Reply all
Reply to author
Forward
0 new messages