Re: Constructing / rendering a complex

Tue, 02 Aug 2011 17:34:56 -0700

Hi i dont see what is complex about this.

On Wed, Aug 3, 2011 at 6:35 AM, Michał Sawicz <mic...@sawicz.net> wrote:
> Hi all,
>
> I'd like to pick your brainz about how would you approach constructing
> and rendering a complex table with headers, row/colspanning cells in a
> most clean way that rids the view of rendering as much as possible.
>

The view 'rendering' as much as possible. So i assume you would rather
have an initial template rendered. then perhaps have views that
deliver data via JSON or something? AJAX+JSON

> Here's roughly what I'm after (incomplete, but you should see what I
> mean):
> http://imageshack.us/f/845/zrzutekranuqv.png/
>
> There are three approaches I can think of:
>
>     1. Construct a complete grid in the view, along with row/colspans
>        that I would simply iterate over and render in the template, but
>        that would make it virtually impossible to change the
>        appearance.

I cant see why it would be impossible to change. Use javascript to
change the table col and rowspans. (why do visual formatting work on
the serverside if you can do it clientside)
at the very least you can have style="display:None" and variious other
CSS rules to help with any dynamic changes to the table.

>     2. Count the cells / rows and compare them with data from the view
>        to decide on how that particular cell should behave, but that
>        makes the template a nightmare.

I dont quite understand this one. If you are comparing data
server-side then submitting data via a form would be recommended.
Where is the data being changed that requires the comparison anyway?

>     3. ID all the cells and change the attributes accordingly, but for
>        rowspanning cells I wouldn't know in the consecutive rows that
>        there in fact was a cell and I might want to repeat it. Maybe I
>        could fill in the complete grid but make the ones that get
>        spanned ignorable in the template through a class.
>

use multiple classes eg <td class="A B C"> jse a javascript library to
add remove classes select child elements of the DOM im sure the
information doesnt have to be partitioned down the a super fine level
of granularity requiring individual id's for every element does it?

What javascript library do you use? jquery, prototype, dojo etc all
good options to simplify manipulation of DOM elements.

> I'll take all thoughts :)
> --
> Michał (Saviq) Sawicz <mic...@sawicz.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-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