I do not know if this helps but perhaps something like this?

jQuery('tr').each(function(this){var a=jQuery(this).child('td:eq(1)');
if(parseFloat(a.html())<0) a.css('color','red')});

1 is the col number

On Feb 26, 1:23 am, BrendanC <bren...@gmail.com> wrote:
> Massimo,
> Thx for the response - however that's the html table approach (not
> what I would call a real datagrid).
>
> I was really looking for a more dynamic/Web 2.0 approach using a
> browser based ( jquery/other)  datagrid. I was envisioning returning
> data in json format and then having that rendered in a client/browser
> grid control. A datagrid would allow a user to click on column header
> and sort the data (w/o sending a server refresh request).
>
> Since the presentation style is dictated by business rules ( e.g.
> rules for overdue book, payments etc can vary) assigning a css style
> to each cell in the view may make sense - however I'm not sure how
> that could work with json/jquery. Maybe I'm on a fool's errand here,
> but I've done this a lot with client/server and desktop apps ( and
> with Adobe Flex/Actionscript) , but I have not seen a (non HTML)
> browser implementation of this.
>
> Any further thoughts?
>
> On Feb 25, 10:07 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > I think this is transparent to jquery. Something like this?
>
> > #Model
> > db.define_table('person',Field('name'),Field('balance','double'))
>
> > #controller
> > def index(): return dict(people=db().select(db.person.ALL))
>
> > #view
> > {{extend 'layout.html'}}
> > <style>
> > .red { backrgound-color: red; }
> > .green {background-color: green; }
> > </style>
> > <table>
> >   {{for p in people:}}
> >   <tr>
> >      <td>{{=p.name}}</td>
> >      <td class="{{'red' if p.balance<0 else 'green'}}">{{=p.balance}}</
> > td>
> >   </tr>
> >   {{pass}}
> > </table>
>
> > On Feb 25, 11:57 pm, BrendanC <bren...@gmail.com> wrote:
>
> > > I'm interested in building a web2py demo that show color coded data in
> > > a (jquery?) datagrid. Ideally cells would be  color coded based on the
> > > underlying data value (e.g. neg values, overdue dates etc. in red).
> > > This type of display is pretty common in desktop apps, spreadsheets
> > > etc. but I have not found any web based examples ( which seems a bit
> > > odd - not sure why ).
>
> > > Are there any web2py examples of something like this?
>
> > > TIA,
> > > Brendan

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to