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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.