On Thursday, May 21, 2015 at 4:06:07 PM UTC-7, 黄祥 wrote: > > I don't understand why you have the same calculation in your controller >> and your view, >> > > not sure what do you mean about calculation, i think is about variable > definition (status and value) i define it on controllers and views > e.g. > 1. if i'm not define the variable status and value in views, it will > return an error > 2. if i define variable status and value on top of the views (1st line of > the file), not using condition check, the result is not expected (no error > occured) > 3. the one that catch up with my expected is like above because it will > recross check again all the value of total debit, total credit, status, > either, the page 1st load or the page is had the new value with ajax > callback. > > >> or where the "total_debit" and "total_credit" come from (maybe you're >> just not showing all the detail, but your controller's return isn't passing >> those to the view). >> > > yes, as it said in the code """ cutted """ >
Well, it was kinda confusing to read your example. But if you're checking those values in controller, do you need to check them in the view? > > >> >> Also, in your return, do you need to fill in 'value' like you do for >> 'status'? >> return "jQuery('#status').html('%s'); jQuery('#status').css('class', >> %s);" % (status, value) >> >> > yes, because like anthony explaination, the procedure is removeclass() > first to complete remove existing css class and then re addclass() again > with the 'css' value from the controller. > For some reason I didn't see Anthony's post. I see that he does have both values substituted in, with the "where" updated as you noticed. /dps -- 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.