try:

def editablefunction():
   id = request.vars.row_id
   column = request.vars.column
   db(db.order_lines.id==id).update(column=value)
  * db.commit()*


On Tue, Jul 19, 2011 at 7:17 AM, Will <g2g.gir...@gmail.com> wrote:

> Hello, i'm currently tryin to make the Powertable plugin's in-line
> editing part work and after many tries i'm currently using Bruno
> Rocha's suggestion in another topic:
>
> Default.py=
>
> def editablefunction():
>    id = request.vars.row_id
>    column = request.vars.column
>    db(db.order_lines.id==id).update(column=value)
>
> def index():
>
> unit=auth.user.unit
> actuel= db(db.orders.unit==auth.user.unit).select(db.orders.ALL,
> orderby=db.orders.id).last()
> actuel_lignes =
> db(db.order_lines.orders==actuel.id).select(db.order_lines.ALL)
>
> powerTable = plugins.powerTable
> powerTable.datasource = actuel_lignes
> powerTable.dtfeatures['sScrollY'] = '100%'
> powerTable.dtfeatures['sScrollX'] = '100%'
> powerTable.virtualfields = None
> powerTable.headers = 'labels'
> powerTable.showkeycolumn = False
> powerTable.dtfeatures['bJQueryUI'] = request.vars.get('jqueryui',True)
> powerTable.uitheme = request.vars.get('theme','redmond')
> powerTable.dtfeatures['sPaginationType'] =
> request.vars.get('pager','full_numbers') # two_button scrolling
> powerTable.columns =
> ['order_lines.orders','order_lines.product','order_lines.amount']
>    powerTable.hiddencolumns = None
> powerTable.extrajs = dict(autoresize={},tooltip={},
> editable={'editablecallback':'URL(default,editablefunction)'})
>
> return dict(unit=unit, archi=archi, actuel=actuel, mois=mois,
> next=next, actuel_lignes=actuel_lignes, table=powerTable.create())
>
> view=
> {{=table}}
>
> The table displays the selection like it should and shows the right
> rows, and the records are clickable and become editable, but when i
> edit a record in the table, the edit isn't saved to my database
> (db.order_lines, table displays actuel_lines, a selection from that
> db)
> and the table cells ( so the records in the database) keep their
> original values when i edited them.
>
> What is missing to make the edits in the table actually update the
> records in the Db ?
> Thanks in advance.
>



-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]

Reply via email to