These are chat archives for ractivejs/ractive

4th
Jul 2017
Chris Reeves
@evs-chris
Jul 04 2017 00:02
that's quite a bit of data... chokes my phone a bit ­čść
Juan C. Andreu
@andreujuanc
Jul 04 2017 16:01
I'm testing something and I used a sort function like so: {{#each sortFunc1(items) }} .....
Inside that, i did {{ @this.something(@keypath) }}
Keypath has the sort function, makes sense, but, how can I evaluate that? get wont work using that keypath. and update neither
If anyone has a best practice for this, I would appreciate it lots.
Meanwhile i'll maybe just sort the array internally
Chris Reeves
@evs-chris
Jul 04 2017 16:09
You can pass @context to somethingand use context relative versions of the usual ractive methods from there
Martin Kolárik
@MartinKolarik
Jul 04 2017 16:14
now that you mention sorting, @evs-chris is there an example/explanation for ractive.sort() anywhere? I noticed it exists yesterday, but couldn't find what it actually does
Chris Reeves
@evs-chris
Jul 04 2017 16:15
I believe it's a proxy for Array.sort
Juan C. Andreu
@andreujuanc
Jul 04 2017 16:15
with the same arguments?
Chris Reeves
@evs-chris
Jul 04 2017 16:16
Well, plus a leading keypath, like splice and friends
Martin Kolárik
@MartinKolarik
Jul 04 2017 16:17
so sort(keypath, sortFunction)
that would make sense
docs say it only takes keypath as an argument, which is why I was a little confused
Chris Reeves
@evs-chris
Jul 04 2017 16:23
yeah, it's a proxy for Array.sort plus an update
Martin Kolárik
@MartinKolarik
Jul 04 2017 16:23
indeed, thanks!
will update the docs