For grid export menu I'm happy with below method

In the views/*.html file where is your grid put on top (just below extend 
layout command)  the following code:

{{
w2p_grid_tbl = grid.element('table')
if w2p_grid_tbl:
 export_menu = grid.element('div.w2p_export_menu')
 export_menu_links = export_menu.elements('a')
 export_menu_items = []
 for link in export_menu_links:
     item = LI(link)
     export_menu_items.append(item)
 pass
 export_menu = grid.element('div.w2p_export_menu',replace=None)
 new_export_menu = DIV(
                      A( T('Exports'),
                         SPAN(_class='caret'),
                         _href='#',
                         _class='btn dropdown-toggle',
                         **{'_data-toggle':"dropdown"}
                        ),
                      UL(*export_menu_items,
                         _class='dropdown-menu'
                        ),
                    _class='w2p_export_menu btn-group'
                    )
pass
}}

In the attached picture you can see how the exports menu is rendered using 
css bootstrap framework.

The method is based on Server-side DOM and parsing (
http://web2py.com/books/default/chapter/29/05#Server-side-DOM-and-parsing) 
and it uses the elements argument "replace" (new beatiful and powerful - in 
my opinion - feature). For reference you could read 
https://groups.google.com/forum/?fromgroups=#!topic/web2py/fbYZXoIOkCY

I hope this will help you.

 

Il giorno lunedì 22 ottobre 2012 17:15:37 UTC+2, Omi Chiba ha scritto:
>
> New export function on grid has many choices but I need to keep the old 
> format. (Export button for csv) because...
>
> - I'm using the gird for users (Maybe this format is good for us but not 
> users.)
> - Current export options layout is not pretty (I prefer button with 
> dropdown list)
> - I don't want users to see hidden columns
>
> Is there any option available for me?
>
>

-- 



<<attachment: web2py_grid_menu_exports.png>>

Reply via email to