Hi,
I would like to display a formatted price using
{function::<function_name>} data reference in paged view, but
I keep getting the “processTokens: Failed to get a data set
context!” error message and don’t know what I’m doing wrong.
Here is the sample:
var ItemDataSet = new Spry.Data.DataSet();
ItemDataSet.setColumnType(‘price’, ‘number’);
var ItemPagedView = new Spry.Data.PagedView(ItemDataSet, {
pageSize: 30 });
ItemPagedView.setColumnType(‘price’, ‘number’);
function formatPrice(region, lookupFunction)
{
// just returning the value to see if it’s working…. but
not working.
return lookupFunction(‘price’);
}
<div spry:region=”ItemPagedView ItemDataSet”>
<table>
<tr>
<td spry:sort=”itemName”>Product Name</td>
<td spry:sort=”price”>Price</td>
</tr>
<tr spry:repeat=”ItemPagedView”>
<td>{itemName}</td>
<td>{function::formatPrice}</td>
</tr>
</table>
</div>
Please help
|||
Hi,
Wrap your data refs in {}:
return lookupFunction(‘{price}’);
and ensure that you have Spry 1.6.1.
Related posts:
- PagedView/DataSet sorting problem
- how to select an item in the column and row in Data set
- Tweaking a sort
- How to reload then sort xml data
- spry:sort on nested data set
Related posts brought to you by Yet Another Related Posts Plugin.