Here's an example, on how to use it:
directive:{
'tbody tr':{
'player<-players':{
'td':'player'
},
sort:function(a, b){
return a > b ? 1 : -1;
}
}
}
Download the revision 2.30 from http://github.com/pure/pure
And check the example 4 in the examples page /index.html
It works well in our app, but please try it.
Feedback, ideas for other utility, suggestions are welcome.
Cheers,
Mic
On Dec 24 2009, 8:32 am, "Mic (BeeBole)" <tch...@gmail.com> wrote:
> Hi,
> I've added a sort functionality for iterations (only on arrays, not
> object collections).
> The array is sorted before sending it to the rendering engine through
> a JS function.
> It is a classical function as you can use with Array.sort( fn ).
>
> Here's an example, on how to use it:
> directive:{
> 'tbody tr':{
> 'player<-players':{
> 'td':'player'
> },
> sort:function(a, b){
> return a > b ? 1 : -1;
> }
> }
>
> }
>
> Download the revision 2.30 fromhttp://github.com/pure/pure
--
You received this message because you are subscribed to the Google Groups "JavaScript Templates Engine PURE" group.
To post to this group, send email to Pure-Unobtrusive...@googlegroups.com.
To unsubscribe from this group, send email to Pure-Unobtrusive-Rende...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/Pure-Unobtrusive-Rendering-Engine?hl=en.
Here's an example, on how to use it:
directive:{
'tbody tr':{
'player<-players':{
'td':'player'
},
sort:function(a, b){
return a > b ? 1 : -1;
},
filter: function(context) {
return context.item.age < 18;
},
transform: function(context) {
return {
abbreviatedName:
context.item.firstName.charAt(0) + ' ' + context.item.lastName,
roomMate:
determineRoomMatePreference(context.item).fullName
}
}
}
}
On Dec 24 2009, 11:32 am, "Mic (BeeBole)" <tch...@gmail.com> wrote:
> Hi,
> I've added a sort functionality for iterations (only on arrays, not
> object collections).
> The array is sorted before sending it to the rendering engine through
> a JS function.
> It is a classical function as you can use with Array.sort( fn ).
>
> Here's an example, on how to use it:
> directive:{
> 'tbody tr':{
> 'player<-players':{
> 'td':'player'
> },
> sort:function(a, b){
> return a > b ? 1 : -1;
> }
> }
>
> }
>
> Download the revision 2.30 fromhttp://github.com/pure/pure
The filter idea is great! When done in pure.js, it will save me some
code too.
Thanks,
BTW: it is Pure Awesomeness that you have wrought.
> > > Mic- Hide quoted text -
>
> - Show quoted text -