Try something simpler:

response.headers['web2py-component-command']="alert('hello world');"

and make sure you have the web2py_ajx.html from the latest welcome
app.

On Feb 4, 10:13 am, Stefan <stefan.louis.no...@gmail.com> wrote:
> Thanks for the response, Massimo.
>
> However! I can't seem to get the command to execute.  I event tried
> including:
>
> response.headers['web2py-component-flash'] = "Updated!"
>
> but my after I make the Ajax call, I get a static table with no flash
> message.
>
> In default.py:
> def data():
>     rows= db().select(db.statustable.ALL,
> orderby=db.statustable.createdon)
>     response.headers['web2py-component-flash'] = "Updated!"
>     response.headers['web2py-component-
> command']="jQuery('.MyData').dataTable();"
>     return plugin_datatable(rows,_class='MyData', truncate=34)
>
> In default/index.html:
> <form>
> <INPUT type="button" value="Refresh"
> onclick="ajax('{{=URL(r=request,f='data')}}',[],'target');"/>
> </form>
>
> <div id="target" style="height:
> 960px">{{=plugin_datatable(rows,_class='MyData', truncate=34)}}</div>
>
> Is there something I'm missing here?
>
> Thanks!
>
> On Feb 4, 9:57 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > There is a js code that trigger datatable, something like
> > "jQuery('.table_class').dataTable();". You want the script to be
> > executed AFTER the ajax content is retrieved. Web2py provides a
> > mechanism for this:
>
> > def data():
> >     rows=
> > db().select(db.statustable.ALL,orderby=db.statustable.createdon)
> >     
> > response.headers['web2py-component-command']="jQuery('.table_class').dataTable();"
> >  #<<<<
> >     return plugin_datatable(rows,_class='datatable', truncate=34)
>
> > The magic happens in #<<<. replace .table_class with the class of the
> > table.
>
> > On Feb 4, 6:01 am, Stefan <stefan.louis.no...@gmail.com> wrote:
>
> > > Hi all,
>
> > > (Sorry for the double-post in another thread: I thought that this
> > > should be its own post.)
>
> > > What's the trick to update a plugin_datatable display via an Ajax
> > > call?  As an example, I have the function:
>
> > > def data():
> > >     rows= db().select(db.statustable.ALL,
> > > orderby=db.statustable.createdon)
> > >     return plugin_datatable(rows,_class='datatable', truncate=34)
>
> > > However, when I make an Ajax call to return this, I get a standard/
> > > static SQLTABLE-esque form of the data.
>
> > > Your help is appreciated!
>
> > > Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to