Hi,
I’m having a problem sorting number column using PagedView.
Here is the JavaScript (partial):
var dataset = new Spry.Data.XMLDataSet(null, ‘/Items/Item’);
dataset.setColumnType(‘price’, ‘number’); // dataset is
loaded with items using Ajax request later on…
var view = new Spry.Data.PagedView(dataset);
Here is the HTML (partial):
<div spry:region=”view dataset”>
<table>
<tr>
<td spry:sort=”itemName”>Item Name</td>
<td spry:sort=”price”>Price</td>
</tr>
<tr spry:repeat=”view”>
<td>{itemName}</td>
<td>{price}</td>
</tr>
</table>
</div>
When I click on “price” column, it is sorted as “string”
instead of “number”. I would like to sort it as number. The column
type for “price” is set to number. Is there a workaround for this?
|||
I think you need to set the column type on the paged dataset.
view.setColumnType(‘price’,'number’);|||
Oops, thanks for letting me know. Didn’t notice that the
PagedView had a method to set its column type….
Related posts:
- PagedView state problem
- How to add additional data to an existing dataset
- Can you specify spry:region to call a dataset dynamically?
- Selected row on a spry table
- Column widths in Spry dataset display
Related posts brought to you by Yet Another Related Posts Plugin.