add icons to table

38 views
Skip to first unread message

Iancic Bogdan

unread,
Aug 26, 2015, 8:54:25 AM8/26/15
to web2py-users
I want to add a column to my table where will be displayed icons. Also, when the user clicks on the icon I would like the icon to overlay.

Can anyone help? I looked over the documentation but I didn't find anything

Iancic Bogdan

unread,
Aug 26, 2015, 9:03:04 AM8/26/15
to web2py-users
All the images will be saved in static

Ovidio Marinho

unread,
Aug 26, 2015, 9:09:57 AM8/26/15
to web...@googlegroups.com





                   http://itjp.net.br
                     http://itjp.net.br
          Ovidio Marinho Falcao Neto
                 ovid...@gmail.com

                            Brasil
            

--
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/d/optout.

Dave S

unread,
Aug 26, 2015, 4:12:26 PM8/26/15
to web2py-users
What do you mean by "overlay"?

I do something like this in a view:

<TABLE>
/* thead stuff */
          {{if datalist[3] == 0:}}
          {{errstat = IMG(_src=URL('static', "images/greenlite.png"), _alt="Green Traffic Light Picture")}}
          {{else:}}
          {{errstat = IMG(_src=URL('static', "images/redlite.png"), _alt="Red Traffic Light Picture")}}
          {{pass}}
          {{=TR(/* various fields */, TD( A(errstat,_href=URL('detailinfo.html',
                  vars=dict(var1=datalist[1], var2=datalist[0])))))
          }}
</TABLE>

clicking on the image takes you to a page that gives you more detail.  You could make that be an AJAX call if you wanted the details to be shown in a DIV on the current page.


/dps

Dave S

unread,
Aug 26, 2015, 4:13:33 PM8/26/15
to web2py-users

For HTML created in a controller, I do
  if ord(msg[1]) == 0:
    display_str = CAT(display_str,
                  "                      ",

                  IMG(_src=URL('static', "images/redlite.png"),
                               _alt="Red Traffic Light Picture"),
                  "\n")
  else:
    display_str = CAT(display_str,
                  "                        ",

                  IMG(_src=URL('static', "images/greenlite.png"),
                               _alt="Green Traffic Light Picture"),
                  "\n")
  display_str = display_str +  "       error flags:\n"


but that part isn't incorporated into a table (it's displayed in a PRE block).

/dps
 
Reply all
Reply to author
Forward
0 new messages