[web2py] Re: Updating contents of plugin_datatable via Ajax?
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.
[web2py] Re: Updating contents of plugin_datatable via Ajax?
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.
[web2py] Re: Updating contents of plugin_datatable via Ajax?
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.
Re: [web2py] Re: Updating contents of plugin_datatable via Ajax?
Speaking of plugin_datatable, the example at http://www.web2py.com/plugins/default/datatable looks v. messed up via Safari and Firefox (I haven't tried anything else). Is that expected? I get something similar when I use it in my own app. FWIW, the CSS doesn't validate. (Among other things, // is not a comment delimiter in CSS.) http://jigsaw.w3.org/css-validator/validator?uri=http://www.web2py.com/plugins/default/datatable -- 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.
[web2py] Re: Updating contents of plugin_datatable via Ajax?
Hi Jonathan, I noticed the same thing. To fix it, you need to modify the CSS file: PluginsdatatableStatic filesplugin_datatable*.css Update it with the following configuration: .dataTables_wrapper { // position: relative; // min-height: 100px; // _height: 302px; // clear: both; float: left; } On Feb 4, 5:04 pm, Jonathan Lundell jlund...@pobox.com wrote: Speaking of plugin_datatable, the example athttp://www.web2py.com/plugins/default/datatablelooks v. messed up via Safari and Firefox (I haven't tried anything else). Is that expected? I get something similar when I use it in my own app. FWIW, the CSS doesn't validate. (Among other things, // is not a comment delimiter in CSS.) http://jigsaw.w3.org/css-validator/validator?uri=http://www.web2py.co... -- 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.
Re: [web2py] Re: Updating contents of plugin_datatable via Ajax?
On Feb 4, 2010, at 6:55 PM, Stefan wrote: Hi Jonathan, I noticed the same thing. To fix it, you need to modify the CSS file: PluginsdatatableStatic filesplugin_datatable*.css Update it with the following configuration: I ended up using dataTables directly, instead of the plugin, and it's working OK. BTW, // isn't a comment delimiter in CSS; you want to use /* this */. .dataTables_wrapper { // position: relative; // min-height: 100px; // _height: 302px; // clear: both; float: left; } On Feb 4, 5:04 pm, Jonathan Lundell jlund...@pobox.com wrote: Speaking of plugin_datatable, the example athttp://www.web2py.com/plugins/default/datatablelooks v. messed up via Safari and Firefox (I haven't tried anything else). Is that expected? I get something similar when I use it in my own app. FWIW, the CSS doesn't validate. (Among other things, // is not a comment delimiter in CSS.) http://jigsaw.w3.org/css-validator/validator?uri=http://www.web2py.co... -- 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. -- 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.