Grid and mouseover/tooltips

121 views
Skip to first unread message

Warren Block

unread,
Sep 24, 2013, 4:21:31 PM9/24/13
to web...@googlegroups.com
With some fields truncated in a grid, it would be nice to show the full
value in a tooltip when the mouse is over it. Offhand, I think that
will take a calculated field. Is there an example anywhere? For that
matter, examples of general examples of grid use would be really nice.

Thanks!

Niphlod

unread,
Sep 24, 2013, 4:47:22 PM9/24/13
to web...@googlegroups.com
alter the represent of the fields in the controller running the grid: it's the right tool for the job

e.g.

db.table.field.represent = lambda value, row : DIV("%s ..." % value[10], _title=value)

Massimo Di Pierro

unread,
Sep 24, 2013, 4:54:27 PM9/24/13
to
You can use represent

db.table.field.represent = lambda value, row: SPAN(value[:10],DIV(value,_class='tooltip'))

and than JS

jQuery(function(){
   jQuery('.tootip').each(function(){
      var t = jQuery(this); 
      t.hide().css('position','relative').css('z-index','200');
      t.parent.mouseover(function() {t.fadeIn();}); 
      t.parent.mouseout(function() {t.fadeOut();});      
   });
});

Mind I did not try it.

Warren Block

unread,
Sep 24, 2013, 5:21:49 PM9/24/13
to web...@googlegroups.com
Nice--that works great!
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages