Download jeditable,
Install in the static/js folder.
Include in layout.html i.e.
<script src="{{=URL('static','js/jquery.jeditable.js')}}"></script>
*Model*
db.define_table('dogs',
Field('dog_name','string'))
*Controller:*
def populate():
db.dogs.truncate()
db.fleas.truncate()
db.dogs.insert(dog_name='dagwood')
db.dogs.insert(dog_name='daisy')
def dogs():
db.dogs.dog_name.represent = lambda value, row: DIV(value if value else
'-',_class='dog_name', _id=str(row.id)+'.dog_name')
g = SQLFORM.grid(db.dogs, searchable=False, csv=False, user_signature=
False)
return dict(form = g)
def upd_dog_name():
id,column = request.post_vars.id.split('.')
value = request.post_vars.value
db(db.dogs.id == id).update(**{column:value})
return value
*View:*
{{extend 'layout.html'}}
<script>
jQuery(document).ready(function(){
jQuery('.dog_name').editable("{{=URL('dogs', 'upd_dog_name')}}",{
tooltip: "Click to edit, enter to save",
indicator : 'updating',
});})
</script>
<div id='dogs'>
{{=form}}
</div>
--
---
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/groups/opt_out.