Thanks Daniel. I am working in the way just as you said.


On Dec 1, 10:21 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Dec 1, 3:53 pm, David <ww...@yahoo.com> wrote:
>
>
>
>
>
> > Hello John and Daniel, thanks for your replies. Let me tell what I
> > need in more details.
>
> > {% for value in data %}
> >             <tr
> >                    {% ifequal all_domain 1 %}
> >                           class="odd" id="{{value.publisher}}"  ????
> > "showDomain('{{value.publisher}}', '{{value.country}}');"
> >                    {% else %}
> >                           class="odd" id="{{value.publisher}}"
> > onclick=
> > "showDomain('{{value.publisher}}', '{{value.country}}');"
>
> >                    {% endifequal %}
> >             >
>
> >       ...........
> > {% endfor %}
>
> > Here "showDomain(...)" is ajax. There are many lines of records on the
> > webpage. If I click a line, then just below this line it shows domain
> > related information. This is realized with the "onclick=..." in the
> > script.
>
> > Now my question is: if I want to show all domain related information
> > for each line without clicking any lines, how can I do it?
>
> > Here is an example. On my webpage I have
> > -------- line 1 ------------------------
> > -------- line 2 ------------------------
> > -------- line 3 ------------------------
>
> > If I click "line 2", then I get
> > -------- line 1 ------------------------
> > -------- line 2 ------------------------
> > ======== line 2 related domain =========
> > -------- line 3 ------------------------
>
> > Now I do not want to click any lines, however I want to show all
> > domain related information when a browser loads this data. It should
> > look like
>
> > -------- line 1 ------------------------
> > ======== line 1 related domain =========
> > -------- line 2 ------------------------
> > ======== line 2 related domain =========
> > -------- line 3 ------------------------
> > ======== line 3 related domain =========
>
> > Is this clear?
>
> > Any suggestions?
>
> > Thanks so much.
>
> This should be done in the template or the view. You know you want
> this at the outset, so why would you use ajax for it? That just means
> you would be making one extra HTTP request for *every single* line in
> your table. That makes no sense at all, and would massively slow down
> the loading of your page.
>
> Presumably your ajax function is accessing your Django site. So, for
> example, move that code into a templatetag, then you can call it via
> the Django template language without any javascript being necessary at
> all.
> --
> DR.- Hide quoted text -
>
> - Show quoted text -

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to