Change 'working...' message in ajax links

32 views
Skip to first unread message

Ian W. Scott

unread,
Mar 18, 2014, 12:45:12 PM3/18/14
to web...@googlegroups.com
I want to change the default 'working...' message presented in an ajax link while it is waiting for the callback to return. I couldn't find anything about this in the web2py manual, but looking in web2py.js it looks like the message can be overridden by setting the data-disable-with value on the link, e.g.:

myargs = {'data-disable-with': IMG(_src='coolspinner.gif')}
A('mylink', _href=URL('some', 'view'), **myargs)

(I believe the indirect insertion of the data-disable-with property is necessary because of the hyphens in the property name.)

But how would I change the default for all of my ajax links? Obviously I can just change line 474 of web2py.js, but that's a bit fragile because when I update my app with new versions of that file there's the risk of regression. So is there any way of setting this default value, say in db.py, for the whole app? If not, is this something we could add to the api? I suspect it's something that many will want to tweak to fit their own themes.

On a similar note, is there a way to set a custom default value for the 'content' property of the LOAD helper? (Again, I'd like to set the new default in one place for the whole app.) I suppose I could subclass the LOAD helper, but that seems a bit heavy-handed. 

Thanks,

Ian
Reply all
Reply to author
Forward
0 new messages