Hi, I've been using web2py for awhile, and I'm developing an application based on the use of components. I'm trying to reload a smartgrid component after a delete action in a controller.
Essentially, I have an SQLFORM.grid() that I use to display records in a db table, but because of customer requests I'm using modals and components instead of the built-in CRUD functionality in the form. I've added links with custom forms to do these actions, after which the grid is supposed to reload and reflect the recent changes made by the user, but the delete action doesn't reload the grid, unlike the rest. Here's the code: Controller: > def delete(): > """ > Deletes an external medic record in the database > :return: > """ > from dao import DAOExternalMedic > DAOExternalMedic().delete(request.args[0]) > session.flash = "Record deleted" > # response.js = "jQuery('#%s').reload()" % DivEnums.MAINGRID > url = URL('external_medics', 'w_manage.load') > response.js = "web2py_component('%s','%s');" % (url, DivEnums.MAINGRID) > redirect(URL('index')) > return > > DivEnums.MAINGRID = 'manage'. It's used in the component's div id tag, so it should work. Only it doesn't. The record is deleted and the response.flash message is displayed, yet the component doesn't reload to show the user the SQLFORM.grid reflecting the changes. I've tried using the jQuery example from this section of the manual: http://web2py.com/books/default/chapter/29/12/components-and-plugins#Reload-another-component I don't use Javascript, so I'm really in the dark about how this part of the framework works beyond what's explained on the manual. I looked for a previous post about this issue but couldn't find much (I'm building the components from modules, not using the LOAD() helper). Thanks in advance. -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.