@Konstantin Sushenko nice catch!
>> as a result of this you will have a series of 'data[i] = ...'
>>assignments in your output. where 'i' would be undefined.
So could he use this: JS isn't my thing, and this is approaching
too_clever
> $(function() {
i = 0;
> var data = [];
> {% for x in content %}
> data[i] =
> {
> roll_no: {{x.roll_no}},
> cell_no: {{x.cell_no}},
> nationality:{{x.nationality}},
> e_mail:{{x.e_mail}}
> };
i +=1;
> {% endfor %}
> grid = new Slick.Grid("#myGrid", data, columns, options);
> $("#myGrid").show();
> })
>
> and the error i get is
>
> Exception Type: TemplateSyntaxError
> Exception Value: Could not parse the remainder: '(len(content))' from
> 'range(len(content))'
>
> Template error
>
> In template d:\django-1.3\django\bin\onlinedemo\dbdemo\templates\db.html,
> error at line 34
> Could not parse the remainder: '(len(content))' from 'range(len(content))'
>
> --------------
>
> On Tue, Aug 16, 2011 at 4:50 AM, Konstantin Sushenko <[email protected]>wrote:
>
>
>
>
>
>
>
> > hello,
>
> > as a result of this you will have a series of 'data[i] = ...'
> > assignments in your output. where 'i' would be undefined.
>
> > konstantin
>
> > On Aug 15, 7:45 pm, Adam Zedan <[email protected]> wrote:
> > > Hi i am getting a problem with my for loop which i used in my
> > template.Could
> > > you kindly let me know what is going wrong in here.
> > > The for loop is in a jquery function
>
> > > $(function() {
> > > var data = [];
>
> > > {% for x in range(len(content)) %}
> > > data[i] =
> > > {
> > > roll_no: {{content[x].roll_no}},
> > > cell_no: {{content[x].cell_no}},
> > > nationality:{{content[x].nationality}},
> > > e_mail:{{content[x].e_mail}}
>
> > > };
> > > {% endfor %}
>
> > > grid = new Slick.Grid("#myGrid", data, columns, options);
>
> > > $("#myGrid").show();
> > > })
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.