Jump to content

math with spry data


simon551

Recommended Posts

Hi,

 

I'm using php to generate spry xml data for a sortable report. and I'm wondering if anybody knows how to do a little math on the data. I just want to total a column.

 

this is my repeat, sortable, column:

 

      <td>{rTotal}</td>

 

I'd like to have another field in a new row (after all the repeat obviously with something like this:

    <tr>

        <td>{sumTotal}</td>

    </tr>

 

I haven't found any documentation on working with the data. do I need to learn xQuery to be able to do this?

 

thanks in advance

-s

 

This is my full code:

<script src="../SpryAssets/xpath.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryData.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
var dsTr = new Spry.Data.XMLDataSet("sources/get_tr_byContract_entryDets.php", "entries/entry",{sortOnLoad:"aName",sortOrderOnLoad:"ascending"});
dsTr.setColumnType("tsdate", "date");
dsTr.sort("tsdate");

//-->
</script>
</head>
<body>
<div spry:region="dsTr">
  <table>
    <tr class="tableheader">
      <th spry:sort="tsdate">Date</th>
      <th spry:sort="employee">Employee</th>
      <th spry:sort="aName">Activity</th>
      <th spry:sort="sowCategory">Category</th>
      <th spry:sort="rTotal">Time</th>
      <th spry:sort="description">Description</th>
    </tr>
    <tr spry:repeat="dsTr" spry:odd="d1" spry:even="d0">
      <td>{tsdate}</td>
      <td>{employee}</td>
      <td>{aName}</td>
      <td>{sowCategory}</td>
      <td>{rTotal}</td>
      <td>{description}</td>
    </tr>
    <tr>
    	<td>THIS IS WHERE I WANT TO HAVE THE TOTAL</td>
  </table>
</div>
</body>

Link to comment
https://forums.phpfreaks.com/topic/65855-math-with-spry-data/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.