Hi,

Am facing a problem with the Totaling feature of DisplayTag, am using
DisplayTag v 1.1

The problem description is given below:

The dataset that is being used by DisplayTag (via the name property) does
*not* hold the column value for which i want the total, instead the value of
the total column comes from a different attribute which is picked up from
the request scope.. probably can explain this better with a sample..

so for e.g,

<display:table name="names" id="namesList" requestURI=""
        defaultsort="2"  pagesize="5" class="table" export="false"
style="width:98%" varTotals="totals">

    <display:column property="courseName" sortable="true"
titleKey="table.courseName"/>

    <display:column sortable="true" titleKey="table.numstudents"
total="true">
         <c:out value="${dataMap[namesList.courseName]}"/>
    </display:column>

    <display:footer>
          <tr>
                <td><fmt:message key="table.totalstudents"/></td>
                <td><c:out value="${totals.column2}" /></td>
          </tr>
    </display:footer>
</display:table>

in the above example, 'names' contains a List of Courses, now i have a
separate 'Map<String, Integer>' object in the request Scope which contains
as 'Key' the course name and as 'value' a Integer value with number of
students registered for the course. 

The requirement is to total the number of students in all courses in the
footer of the table.. But when we try to run this example, i get a
ClassCastException.. 

java.lang.ClassCastException: java.lang.String
        at org.displaytag.model.HeaderCell.addToTotal(HeaderCell.java:593)
        ......

addToTotal typecasts the 'value' attribute to Number and this is causing the
exception.. 

also instead of using vartotals, i have tried to use the TotalTableDecorator
but am facing the same issue..

Have recently started using displaytag, so am not sure if i am doing the
correct thing here, would be great if somebody can point me in the correct
direction..

Cheerz,
krish




-- 
View this message in context: 
http://www.nabble.com/Problem-using-total-feature-of-displaytag-tf4054187.html#a11515864
Sent from the DisplayTag - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to