compact grid howto

84 views
Skip to first unread message

Cliff Kachinske

unread,
Oct 9, 2013, 8:51:11 AM10/9/13
to web...@googlegroups.com
SQLFORM.grid for laptops. Less white space, more data. Screen shot at end of post.

in modules, create ui_def.py as follows:
# -*- coding: utf-8 -*-
def uidict():
   
return dict(widget='',
              header
='',
              content
='',
             
default='',
              cornerall
='',
              cornertop
='',
              cornerbottom
='',
              button
='',
              buttontext
='',
              buttonadd
='icon plus icon-plus',
              buttonback
='icon leftarrow icon-arrow-left',
              buttonexport
='icon downarrow icon-download',
              buttondelete
='',
              buttonedit
='',
              buttontable
='icon rightarrow icon-arrow-right',
              buttonview
='',
             
)



Controller:
import ui_def
def index():
    ui
= ui_def.uidict()
    query
= db.product_family.id>0
    form
= SQLFORM.grid(query, ui=ui)
    response
.view = 'iindex.html'
   
return dict(form=form)



Add to layout.html, just before the </head> tag:
 
<style>
     
#header {margin-top:0px;}
      div
.page-header {margin:5px 0 0}
     
.mastheader h1 {font-size:30px}
     
.main {padding: 5px 0 15px 0;}
     
.web2py_breadcrumbs ul {margin-bottom:10px;}
     
.web2py_grid .row_buttons a {padding: 0 5px 0 5px;}
     
.web2py_grid tbody td {padding: 0 5px 0 5px;}
     
.web2py_grid .row_buttons {min-height: 0;}
 
</style>


stefaan

unread,
Oct 9, 2013, 9:30:03 AM10/9/13
to web...@googlegroups.com
Very useful! Thanks.

Niphlod

unread,
Oct 9, 2013, 2:41:16 PM10/9/13
to web...@googlegroups.com
I'd almost publish a plugin for it :P

On Wednesday, October 9, 2013 3:30:03 PM UTC+2, stefaan wrote:
Very useful! Thanks.

Dave S

unread,
Oct 9, 2013, 4:05:32 PM10/9/13
to web...@googlegroups.com

On Wednesday, October 9, 2013 5:51:11 AM UTC-7, Cliff Kachinske wrote:
SQLFORM.grid for laptops. Less white space, more data. Screen shot at end of post.


How are you detecting a laptop?  Are you basing this on the user agent screen size?

/dps

Cliff Kachinske

unread,
Oct 9, 2013, 4:21:09 PM10/9/13
to web...@googlegroups.com
Dave S
Not at all. I'm ignoring handhelds right now and assuming desktop users will also appreciate the extra space.

Cliff Kachinske

unread,
Oct 9, 2013, 4:22:38 PM10/9/13
to web...@googlegroups.com
Niphlod,

Maybe I almost will. :)

Dave S

unread,
Oct 9, 2013, 4:54:39 PM10/9/13
to web...@googlegroups.com
On Wednesday, October 9, 2013 1:21:09 PM UTC-7, Cliff Kachinske wrote:
Dave S
Not at all. I'm ignoring handhelds right now and assuming desktop users will also appreciate the extra space.


Okay.

/dps
Reply all
Reply to author
Forward
0 new messages