Loop refresh

18 views
Skip to first unread message

AECNA

unread,
Jan 10, 2012, 10:32:28 AM1/10/12
to JavaScript Templates Engine PURE
I have a simple UL:

<ul id="...">
<li>
<a class="..." href="...">
<span class="aaa"><span class="text">...</span></span>
<span class="bbb"><span class="text">...</span></span>
<span class="ccc"><span class="text">...</span></span>
<span class="ddd" style="display:none;">
<span class="ddd_aa1">...</span> <span class="ddd_aa2">...</span>
<span class="ddd_bb1">...</span> <span class="ddd_bb2">...</span>
</span>
</a>
</li>
</ul>

and a call to render:

$('#...').directives({
'li': {
'obj<-list': {
'a....@href': function(arg){ return('?xxx='+
(arg.context.list[arg.pos].id));},
'span....@class+': 'obj....',
'span....': 'obj....',
'span....': 'obj....',
'span....': 'obj....'
}
}
})
.render(data);


THE PROBLEM is that if I use it that way, it works. But this loop is
called several times with different data and the list should be
rebuilt. If I call the rendering again, data is added each time (more
and more LIs are added).
If I compile the directives and make a call like "$
('#...').render(data, compiledtemplate);" CSS is scrambled.

I'm using jQuery Mobile and Pure template.

Mic (BeeBole)

unread,
Jan 10, 2012, 10:48:28 AM1/10/12
to JavaScript Templates Engine PURE
What do you mean by CSS is scrambled?
Can you make a working http://gist.github.com?
There are too many "..." to understand what can happen.

AECNA

unread,
Jan 10, 2012, 10:58:50 AM1/10/12
to JavaScript Templates Engine PURE
Eh eh... first of all thankx for your interest: the complete code is
very long, so I can't post it.
Consider that "..." are just name of classes and ids: nothing more,
nothing less.

HTML is coded as shown.

If I make a call like $('#tagid').directives({ ...list-of-
directives... }) .render(data); everything is fine. HTML is rendered
with jQuery Mobile as a list (http://jquerymobile.com/demos/1.0/docs/
lists/lists-ul.html).

If I compile the directive and make a call like $
('#tagid').render(data, template); where template is the compiled
template, the list is rendered as a "simple" html without jQuery
Mobile extra data (so the UL list is shown with the classic bullets on
the left and links are just blu linked texts).

On 10 Gen, 16:48, "Mic (BeeBole)" <tch...@gmail.com> wrote:
> What do you mean by CSS is scrambled?
> Can you make a workinghttp://gist.github.com?

AECNA

unread,
Jan 10, 2012, 11:32:33 AM1/10/12
to JavaScript Templates Engine PURE
The problem seems to be that jQuery Mobile needs to decorate the new
created code... I've tried with a simple $('#tagid').page() but it
doesn't work.

It seems that $('#tagid').listview() is the workaround! This way it
works.

I'm going further to look what to do if I have to manage different
tags (no UI) and so ".listview()" is not an option.
Reply all
Reply to author
Forward
0 new messages