I have something like this in a controller:
@auth.requires_login()
def list_machines():
form=crud.create(db.machine)
form1=SQLFORM(db.machine)
machines=db(db.machine.id>0).select(orderby=db.machine.name)
return dict(machines=machines,form=form,form1=form1)
The view is something like this:
<h1>All Machines</h1>
[<a href="#nil" onclick="jQuery('#form').slideToggle();">Add</a>]
<div id="form">
<h2>New Machine</h2>
{{=form}}
</div>
[<a href="#nil" onclick="jQuery('#form1').slideToggle();">Multi Edit</a>]
<div id="form1">
<h2>Multi Edit Machines</h2>
{{=form1}}
</div>
<br /><br />
<table class="smarttable">
<thead>
<tr>
<th>Name</th><th>Curr Camp</th><th>Next Camp</th><th>Next
Date</th><th>Actions</th>
</tr>
</thead>
<tbody>
{{for machine in machines:}}
<tr>
<td>{{=link_machine(machine)}}</td>
<td>{{=[machine.cur_camp}}</td>
<td>{{=machine.next_camp}}</td>
<td>{{=machine.next_date}}</td>
<td>
{{=button('edit','edit_machine',machine.id)}}</td>
</tr>
{{pass}}
</tbody>
</table>
The purpose of form is to allow new machines to be added and I have that
working.
What I want from form1 is this:
If I put something in the cur_camp field and submit, all rows "selected"
are updated with this new value.
Selected is either every row or every row remaining when something is
searched for.
Basically, I want to be able to do mass edits for certain fields of
selected records. (If the field is left blank, I want to leave that column
as is on the rows.
Has anyone ever done something like this in web2py? Any hints?
all the best,
drew
--
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.