These are chat archives for canjs/canjs

27th
Sep 2016
qantourisc
@qantourisc
Sep 27 2016 14:38
Looked a few times in the API, is there a way to {{key}} without binding ? It takes a bit long to render the template for ~2000 bytes of json data
Christopher Oliphant
@RALifeCoach
Sep 27 2016 15:16
@qantourisc which version of CanJS?
under 2.3 rendering large amounts of data is slow
I fought with the rendering speed for quite some time
qantourisc
@qantourisc
Sep 27 2016 15:23
2.2.4
qantourisc @qantourisc looks into upgrading
Christopher Oliphant
@RALifeCoach
Sep 27 2016 15:23
That’s even older - and probably even slower
3.0 is reported to be faster - my timings have been favourable
qantourisc
@qantourisc
Sep 27 2016 15:24
3.0 big change ?
Christopher Oliphant
@RALifeCoach
Sep 27 2016 15:24
the only problem is 3.0 is still not production ready
qantourisc
@qantourisc
Sep 27 2016 15:24
can't afford that atm :D
Christopher Oliphant
@RALifeCoach
Sep 27 2016 15:25
There are changes - the docs may give some details
Kevin Phillips
@phillipskevin
Sep 27 2016 15:25
@qantourisc can you explain your question a little more?
where are you using {{key}}?
qantourisc
@qantourisc
Sep 27 2016 15:25
@phillipskevin I was wondering if there was a lighter way to put data on the website so it doesn't do a bind, if that has any impact on performance.
note: not updating data
Kevin Phillips
@phillipskevin
Sep 27 2016 15:26
how are you loading the data?
qantourisc
@qantourisc
Sep 27 2016 15:26
JSON
that is then fed into a model and then rendered
Kevin Phillips
@phillipskevin
Sep 27 2016 15:26
the model is loading it from the server?
if you’re just trying to write json data to the page, using CanJS API’s probably isn’t necessary
var jsonData = JSON.stringify({ foo: 'bar' });
var p = document.createElement('p');
p.innerHTML = jsonData;
document.body.appendChild(p);
qantourisc
@qantourisc
Sep 27 2016 16:25
It's a model/map that contains Lists/ModelList, with data, it also takes about 200ms on the client to parse the data to cast and convert it to a model.
Kevin Phillips
@phillipskevin
Sep 27 2016 16:27
ok, so if you’re not using other features of can.Model (like creating new instances, saving, etc), then it might make more sense to just load the raw data
qantourisc
@qantourisc
Sep 27 2016 16:27
But I will first try the upgrade, and at some point, there just is plainly tomuch data. (It's roughly 132 data bind excluding any bttons)
Kevin Phillips
@phillipskevin
Sep 27 2016 16:27
using jquery.ajax or raw xhr
qantourisc
@qantourisc
Sep 27 2016 16:28
It's mainly the map -> render/template that takes up time
Kevin Phillips
@phillipskevin
Sep 27 2016 16:28
if you do need the other model features, then yeah, maybe there’s a way to help the UX by not loading / showing so much data
how are you rendering the template?
is it using a Control or Component?
qantourisc
@qantourisc
Sep 27 2016 16:29
component
But I must leave now
Kevin Phillips
@phillipskevin
Sep 27 2016 16:29
ok
qantourisc
@qantourisc
Sep 27 2016 16:29
thhank you
Kevin Phillips
@phillipskevin
Sep 27 2016 16:29
if you have more detailed questions, feel free to post to the forum
qantourisc
@qantourisc
Sep 27 2016 16:30
no just mainly some tricks to reduce the load of model mapping, if there are none, then there are none
Kevin Phillips
@phillipskevin
Sep 27 2016 16:30
might be worth asking there
give other people a chance to see the question
if you have time
Sunil George
@georgesunil81
Sep 27 2016 20:48
A quick question - I am working with stache and radio buttons. For some reason, the below is giving an error while rendering!
<input type="radio" name="radios" id={{radioButtonId}} value={{token}} {{#if FirstPaymentMethod}}checked{{/if}}>
Kevin Phillips
@phillipskevin
Sep 27 2016 20:48
put quotes around the id and value values
id=“{{radioButtonId}}”
Sunil George
@georgesunil81
Sep 27 2016 20:49
In the above line, I want to select the radio button if it is the FirstPaymentMethod.
Oh, let me put the quotes. How about the checked attribute, would I need to put quotes around that too?
Kevin Phillips
@phillipskevin
Sep 27 2016 20:50
no
you just need quotes around the value of attributes
the right side of the equal sign
Sunil George
@georgesunil81
Sep 27 2016 20:52
Ah! that worked. Was tough to spot that. Thanks @phillipskevin
Kevin Phillips
@phillipskevin
Sep 27 2016 20:52
:thumbsup: