render values repeating multiple times

24 views
Skip to first unread message

Lakshman Tirlangi

unread,
Dec 28, 2011, 4:23:34 AM12/28/11
to JavaScript Templates Engine PURE
Hii..

I have select values as data and using the directive I am populating
the data in select dropdown. I need to get different option values for
select dropdown2 based on the options selected from the dropdown1. But
everytime I reselect the option from dropdown1, option values in the
dropdown2 are getting doubled.. How to fix this render issue using
purejs..

Here is the script that I have used for onchange select.

$('#sel_type').change(function() {
var renderName = $('#sel_type').val();
switch(renderName) {
case "date":
$('#trips_1').render(date, date_directive);
break;
case "trip":
$('#trips_1').render(trip, trip_directive);
break;
case "result":
$('#trips_1').render(result, result_directive);
break;
}
});

Thanx in advance.

Lakshman

Mic (BeeBole)

unread,
Dec 28, 2011, 7:04:50 AM12/28/11
to JavaScript Templates Engine PURE
If you need to use several time the same template, you have to compile
it first.
Then using the render with the compiled function instead of a
directive.

Look at the last example of http://beebole.com/pure/demos/


On Dec 28, 10:23 am, Lakshman Tirlangi <tirlangi.laksh...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages