Hi, 
recently, I ve been strugling with django (having a good time) and 
meanwhile, I tried to find and use a grid.
I found dhtmlx thx to django-users forum.
Now, I think best approah will be structering grid using xml output. 

Below u will find what kind xml, dhtmlx needs.
dhtmlgrid needs a xml output like follows,
"""
<?xml version="1.0"?>
<rows><head><column width='50' align='right' type='dyn' sort='str' 
color=''>Sales</column><column width='150' align='left' type='ed' 
sort='str' color=''>Book Title</column><column width='100' align='left' 
type='ed' sort='str' color=''>Author</column><column width='80' 
align='right' type='price' sort='str' color=''>Price</column><column 
width='80' align='center' type='ch' sort='str' color=''>In 
Store</column><column width='80' align='left' type='co' sort='str' 
color=''>Shipping <option value='1'>1</option><option 
value='2'>2</option><option value='3'>3</option><option 
value='4'>10</option><option value='5'>20</option><option 
value='6'>30</option></column><column width='80' align='center' type='ra' 
sort='str' color=''>Bestseller</column><column width='200' align='center' 
type='ro' sort='str' color=''>Date of Publication</column></head>
<row id='1'><cell>-1500</cell><cell>A Time to Kill</cell><cell>John 
Grisham</cell><cell>12.99</cell><cell>1</cell><cell>24</cell><cell>0</cell><cell>05/01/1998</cell></row>
<row id='2'><cell>1000</cell><cell>Blood and Smoke</cell><cell>Stephen 
King</cell><cell>0</cell><cell>1</cell><cell>24</cell><cell>0</cell><cell>01/01/2000</cell></row>
<row id='3'><cell>-200</cell><cell>The Rainmaker</cell><cell>John 
Grisham</cell><cell>7.99</cell><cell>0</cell><cell>48</cell><cell>0</cell><cell>12/01/2001</cell></row>
<row id='4'><cell>350</cell><cell>The Green Mile</cell><cell>Stephen 
King</cell><cell>11.10</cell><cell>1</cell><cell>24</cell><cell>0</cell><cell>01/01/1992</cell></row>
<row id='5'><cell>700</cell><cell>Misery</cell><cell>Stephen 
King</cell><cell>7.70</cell><cell>0</cell><cell>na</cell><cell>0</cell><cell>01/01/2003</cell></row>
<row id='6'><cell>-1200</cell><cell>The Dark Half</cell><cell>Stephen 
King</cell><cell>0</cell><cell>0</cell><cell>48</cell><cell>0</cell><cell>10/30/1999</cell></row>
<row id='7'><cell>1500</cell><cell>The Partner</cell><cell>John 
Grisham</cell><cell>12.99</cell><cell>1</cell><cell>48</cell><cell>1</cell><cell>01/01/2005</cell></row>
<row id='8'><cell>500</cell><cell>It</cell><cell>Stephen 
King</cell><cell>9.70</cell><cell>0</cell><cell>na</cell><cell>0</cell><cell>10/15/2001</cell></row>
<row id='9'><cell>400</cell><cell>Cousin Bette</cell><cell>Honore de 
Balzac</cell><cell>0</cell><cell>1</cell><cell>1</cell><cell>0</cell><cell>12/01/1991</cell></row>
<row id='10'><cell>-100</cell><cell>Boris Godunov</cell><cell>Alexandr 
Pushkin</cell><cell>7.15</cell><cell>1</cell><cell>1</cell><cell>0</cell><cell>01/01/1999</cell></row>
<row id='11'><cell>-150</cell><cell>Alice in Wonderland</cell><cell>Lewis 
Carroll</cell><cell>4.15</cell><cell>1</cell><cell>1</cell><cell>0</cell><cell>01/01/1999</cell></row></rows>

"""

Currently I cant produce this, But What I do is to creat and xml and return 
it.
my view
"""
def get_data(request):
    if 'posStart' in request.GET:
        offset = request.GET['posStart']
        quantity = request.GET['count']
    else:
        offset = 0
        quantity = 3
    
    data = Material.objects.all()[offset:offset+quantity]
    
    total = Material.objects.all().count()
    return render_to_response(
        'get_data.xml',
        {'data': data, 'total': total, 'pos': offset},
        mimetype='text/xml', context_instance=RequestContext(request))
"""
and get_data.xml
"""
<?xml version="1.0" encoding="UTF-8"?>
<rows total_count="{{ total }}" pos="{{ pos }}">
    {% for i in data %}
    <row id="{{ i.id }}">
        <cell>{{ i.material }}</cell>
        <cell>{{ i.valid_from }}</cell>
        <cell>{{ i.valid_until }}</cell>
        <cell>{{ i.stext }}</cell>
        <cell>{{ i.stext }}</cell>
    </row>
    {% endfor %}
</rows>
"""
Do you think best approach would be to keep doing same thing just, change 
the way I create xml, using a module or something or something else, I saw 
django xml serialization, but couldnt figure out, how to use.
thx.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Su9JlYLruuIJ.
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