JsViews is a great library. And i have been working with it for some time now.
But still i can't find why the hell this event call won't work.
The data after the sorting is right and the arr is good.
sortTiers: function () {
var arr = this.StructureActivitiesTiers.slice()
.sort(function (a, b) { return parseFloat(a.TierTo) - parseFloat(b.TierTo); });
for (var i = 0; i < arr.length; i++) {
arr[i].TierTo = parseFloat(arr[i].TierTo);
arr[i].TierFrom = (i == 0 ? 0 : arr[i - 1].TierTo)
}
$.observable(this.StructureActivitiesTiers).refresh(arr);
}
The template:
{^{for StructureActivities}}
<tr>
<td><input type="text" data-link="Currency"></td>
<td><input type="text" data-link="Price"></td>
</tr>
{^{for StructureActivitiesTiers}}
<tr>
<td></td>
<td>From: <input disabled data-link="TierFrom" type="text">  
To: <input type="text" data-link="TierTo">
</td>
</tr>
{{/for}}
<tr>
<td>
<button data-link="{on 'click' ~sortTiers}"/>
</td>
<td>
</td>
</tr>
{{/for}}
Thanks!