Hi,
If you mean adding rows to the TABLE object it's as simple as:
table1 = TABLE()
table1.append(TR())
If you are asking about how to make the button do it, your best bet is to
use an ajax call to rebuild the table and send it to a div.
Make sure your table is in a div with a set id.
Create a controller function like so:
def ajax_add_row():
return generate_table_from_excel() # or whatever your function for
building the table is called...
And in the INPUT add something like:
url = URL(
r=request,
f='ajax_add_row',
vars={'sheet_id': self.sheet_id}
)
INPUT(_type='submit',_value='AddRows',_id='AddRows', _onclick = "ajax('%s',
[], '%s');" % (url, div_id))
#Where div_id is the id of the div which you're sending the ajax back to
See:
http://www.web2py.com/books/default/chapter/29/11/jquery-and-ajax#The-ajax-function
Use the same function to populate the div on initial page load as you do to
from the ajax call. Note it's handy to have that function easily callable
from something that's not ajax for debugging, as ajax hides the error
message.
Might wanna change your ifs to elifs while you're at it...
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.