Hi

The for tag iterates over the elements of the list you are using so
your code should be

$(function() {
            var data = [];
            var i = something();
               {% for x in content %}
                data[i] =
                {
                    roll_no: {{x.roll_no}},
                    cell_no: {{x.cell_no}},
                    nationality:{{x.nationality}},
                    e_mail:{{x.e_mail}}
                };
                {% endfor %}

            grid = new Slick.Grid("#myGrid", data, columns, options);

            $("#myGrid").show();
        })

On Aug 15, 8:45 pm, Adam Zedan <zedan...@gmail.com> 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 django-users@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