Flexigrid

143 views
Skip to first unread message

Ramesh

unread,
Jul 30, 2010, 2:41:03 PM7/30/10
to Django users
Hi,

I want to use Flexigrid for my project. I have used it before on
TurboGears and it's really nice.

Can somebody please help me how can I use flexigrid for my project?
tutorials link to start for using Flexigrid on django?

Thanks a lot in advance,
RB

Gonzalo Delgado

unread,
Jul 30, 2010, 3:12:13 PM7/30/10
to django...@googlegroups.com
El 30/07/10 15:41, Ramesh escribi�:

> I want to use Flexigrid for my project. I have used it before on
> TurboGears and it's really nice.
>
> Can somebody please help me how can I use flexigrid for my project?
> tutorials link to start for using Flexigrid on django?
>

http://is.gd/dTrPN

--
Gonzalo Delgado <gonza...@gmail.com>

Ramesh

unread,
Aug 2, 2010, 11:45:24 AM8/2/10
to Django users
Hi Gonzalo,

It looks like you are just showing me how to search on google which I
already did but couldn't find the solution I was looking for.

I am still looking forward for the help on flexigrid for my project. I
really appreciate your help.

Thanks!
> Gonzalo Delgado <gonzalo...@gmail.com>

Antoni Aloy

unread,
Aug 2, 2010, 11:56:48 AM8/2/10
to django...@googlegroups.com
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

Ramesh

unread,
Aug 2, 2010, 12:34:26 PM8/2/10
to Django users
Hi Antoni,

Thanks a lot for your quick reply, I will go through the links you
listed.
> json that Flexigrid wants. You can see the json inhttp://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=enhttp://stackoverflow.com/questions/414543/django-serialize-to-json

Gonzalo Delgado

unread,
Aug 3, 2010, 11:07:43 AM8/3/10
to django...@googlegroups.com
El 02/08/10 12:45, Ramesh escribi�:

> It looks like you are just showing me how to search on google which I
> already did but couldn't find the solution I was looking for.
>
> I am still looking forward for the help on flexigrid for my project. I
> really appreciate your help.
>

The first result I get searching with Google turns up a snippet for
integrating Flexigrid into Django[0], did you try that?

[0] http://snippets.dzone.com/posts/show/6917

--
Gonzalo Delgado <gonza...@gmail.com>

Reply all
Reply to author
Forward
0 new messages