Hi Ramesh,

I haven't work with Flexigrid in my projects, but I did it with jqgrid
and as far I can see is quite the same:

In the Flexigrid sample you have:

                        $("#flex1").flexigrid
                        (
                        {
                        url: 'post2.php',
                        dataType: 'json',
                        colModel : [
                                {display: 'ISO', name : 'iso', width : 40, 
sortable : true, align:
'center'},
                                {display: 'Name', name : 'name', width : 180, 
sortable : true,
align: 'left'},
                                {display: 'Printable Name', name : 
'printable_name', width : 120,
sortable : true, align: 'left'},
                                {display: 'ISO3', name : 'iso3', width : 130, 
sortable : true,
align: 'left', hide: true},
                                {display: 'Number Code', name : 'numcode', 
width : 80, sortable :
true, align: 'right'}
                                ],
                        buttons : [
                                {name: 'Add', bclass: 'add', onpress : test},
                                {name: 'Delete', bclass: 'delete', onpress : 
test},
                                {separator: true}
                                ],
                        searchitems : [
                                {display: 'ISO', name : 'iso'},
                                {display: 'Name', name : 'name', isdefault: 
true}
                                ],
                        sortname: "iso",
                        sortorder: "asc",
                        usepager: true,
                        singleSelect: true,
                        title: 'Countries',
                        useRp: true,
                        rp: 15,
                        showTableToggleBtn: true,
                        width: 700,
                        height: 200
                        }
                        );

So the idea is to replace the php url with a django one. ex. /ajax/countries/

That url must map to a view and on that view you have to obtain
(Country.objects.all() if you have such a model) and then return the
json that Flexigrid wants. You can see the json in
http://www.flexigrid.info/post2.php

So the real problem is to know how to map urls to views, and that is
clearly explained in the Django tutorial, and how to return json data
instead of html, which is covered in :

http://docs.djangoproject.com/en/dev/topics/serialization/
http://chronosbox.org/blog/jsonresponse-in-django?lang=en
http://stackoverflow.com/questions/414543/django-serialize-to-json

etc.

With jqrid I was able to map the Django model response directly to the
grid (well almost), but I don't know if this is possible in Flexigrid.
Anyway, you can create your own structure, fill it from the model and
then dump it to json.


Hope it helps!


-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

-- 
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