[web2py] table headers with style
I'm finding that SQLTABLE, though mostly well-behaved, doesn't properly take the th elements into account when sizing the table space; I'd like to add padding-right to those elements, but I've forgotten how to do it. My view looks like: myeheaders: th { padding-right: 2em} ; {{extend 'layout.html'}} This is the default/sorted.html template {{=SQLTABLE(rows, truncate=30, headers = {'tbl1.a':'Ayy', 'tbl1.b':'Bee', 'tbl1.c':'Cee', 'tbl1.d':'Dee'}, columns=['tbl1.a', 'tbl1.b', 'tbl1.c', 'tbl1.d'], _class="myeheaders")}} but I don't have this right, do I? /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.
[web2py] Re: Checking if user is offline/online
On Saturday, December 3, 2016 at 2:25:50 PM UTC-5, Marlysson Silva wrote: > > You can do it with javascript, using: > > Api navigador: > https://developer.mozilla.org/en-US/docs/Online_and_offline_events#Overview > > https://developer.mozilla.org/en-US/docs/Online_and_offline_events#Overview > Looks like that is for tracking whether the browser itself is online vs. offline, not whether the user has simply navigated away from your app or closed the tab. Anthony -- 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.
[web2py] Re: Checking if user is offline/online
You can do it with javascript, using: Api navigador: https://developer.mozilla.org/en-US/docs/Online_and_offline_events#Overview https://developer.mozilla.org/en-US/docs/Online_and_offline_events#Overview Em sexta-feira, 2 de dezembro de 2016 15:11:08 UTC-3, Ramos escreveu: > > What could be the best way to check if a user is disconnects? > > I was thinking of this > > >$(document).ready(function() > { > $(window).bind("beforeunload", function() { > *call a controller function to set the user as offline* > }); > }); > > > but this is not perfect because when the user moves to another URL inside > the same app this event keeps getting triggered on url change. > Any better ideas? > > > Regards > António > -- 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.
[web2py] Re: SQLFORM.grid: using groupby disables create?
In my case, I have records with 2 fields, A & B; I want one record to be displayed for each distinct value of A when B is either 1 or 2, but it is possible that each will be present, so I use groupby A to avoid duplication. I tried using a smartgrid, but it exhibited the same groupby/add behavior (although maybe I could use its constraint parameter to accomplish this without using groupby). - Scott On Saturday, December 3, 2016 at 11:11:58 AM UTC-5, Anthony wrote: > > This is tricky. Write operations (as well as the details view) are > disabled with groupby because the rows in the grid do not necessarily > represent individual records. Of course, that shouldn't necessarily > preclude adding new records, but from a user perspective, we have to think > of what is meant by "Add" in the context of a table that is displaying > aggregated data rather than individual records. Are you adding a new row to > the grid (which doesn't quite make sense) or a new individual record to the > table used to generate the grid (sensible, but maybe not as clear)? > > I don't have a strong opinion, but I suppose it wouldn't be a bad idea to > at least allow the developer the option of enabling create with groupby. In > that case, though, we might have to default to create=False for backward > compatibility. > > Feel free to file a Github issue and refer to this thread. > > Anthony > > On Saturday, December 3, 2016 at 8:53:45 AM UTC-5, Scott Hunter wrote: >> >> I have a SQLFORM.grid in which I would like to use groupby as well as be >> able to create records. But when I supply the groupby parameter, the Add >> Record button disappears, and can be made to re-appear if the only thing I >> change is remove the groupby parameter. >> >> Is this a bug? If it is a feature, can someone explain the reasoning >> behind it, and how I would best work around it? >> >> - Scott >> > -- 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.
[web2py] Re: SQLFORM.grid: using groupby disables create?
This is tricky. Write operations (as well as the details view) are disabled with groupby because the rows in the grid do not necessarily represent individual records. Of course, that shouldn't necessarily preclude adding new records, but from a user perspective, we have to think of what is meant by "Add" in the context of a table that is displaying aggregated data rather than individual records. Are you adding a new row to the grid (which doesn't quite make sense) or a new individual record to the table used to generate the grid (sensible, but maybe not as clear)? I don't have a strong opinion, but I suppose it wouldn't be a bad idea to at least allow the developer the option of enabling create with groupby. In that case, though, we might have to default to create=False for backward compatibility. Feel free to file a Github issue and refer to this thread. Anthony On Saturday, December 3, 2016 at 8:53:45 AM UTC-5, Scott Hunter wrote: > > I have a SQLFORM.grid in which I would like to use groupby as well as be > able to create records. But when I supply the groupby parameter, the Add > Record button disappears, and can be made to re-appear if the only thing I > change is remove the groupby parameter. > > Is this a bug? If it is a feature, can someone explain the reasoning > behind it, and how I would best work around it? > > - Scott > -- 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.
[web2py] Re: sqlform.grid search numeric fields
You can customize the search functionality by providing (a) a custom widget via the "search_widget" argument (it takes a list of searchable fields and a URL and should return a search form) and/or (b) a custom search query builder via the "searchable" argument (it takes a list of searchable fields and the keyword string from the search form and should return a DAL query object). By default, the query builder is gluon.sqlhtml.SQLFORM.build_query -- so check that out to see how it works. When you set advanced_search=False, all it does is disable the Javascript functionality of the search widget that facilitates the advanced search syntax (you can still manually enter advanced search syntax, and you will get an advanced search query). The build_query method looks for quotes in the keyword string and if found, it calls pydal.helpers.methods.smart_query to generate the query. Otherwise, it just does a basic search across text fields (which is what you are getting). Anthony On Saturday, December 3, 2016 at 9:27:39 AM UTC-5, Scott Hunter wrote: > > When using the basic (as opposed to advanced) search function of an > SQLFORM.grid, it only appears to look in text fields, such that if I enter > a number, it doesn't find any matches unless that number appears in a text > field (even if that field is not one of the ones displayed in the grid). > > Is this intentional? Short of using the advanced search, is there a way > to search numeric fields? > > - Scott > -- 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.
[web2py] sqlform.grid search numeric fields
When using the basic (as opposed to advanced) search function of an SQLFORM.grid, it only appears to look in text fields, such that if I enter a number, it doesn't find any matches unless that number appears in a text field (even if that field is not one of the ones displayed in the grid). Is this intentional? Short of using the advanced search, is there a way to search numeric fields? - Scott -- 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.
[web2py] SQLFORM.grid: using groupby disables create?
I have a SQLFORM.grid in which I would like to use groupby as well as be able to create records. But when I supply the groupby parameter, the Add Record button disappears, and can be made to re-appear if the only thing I change is remove the groupby parameter. Is this a bug? If it is a feature, can someone explain the reasoning behind it, and how I would best work around it? - Scott -- 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.
[web2py] Re: SQLFORM.grid and oncreate error
My bad; I was using concrete (the callback for AFTER a record has been created) instead of onvalidation (the one for BEFORE that). On Friday, December 2, 2016 at 11:17:57 PM UTC-5, Scott Hunter wrote: > > If the oncreate callback for a SQLFORM.grid sets form.errors to true, the > record is not created; similarly, if form.errors. is set to an > error message. > > However, shouldn't the form for adding the record return, and in the > latter case, with the specified fields showing their error messages? In my > case, the list comes up instead. > > Here is my form & callback although there isn't much to them: > > def add_handler(form): > if form.vars.f_Member_ID=='': > form.errors.f_Member_ID = "ID required" > session.flash = "ID required" > return > session.flash = "Handler added" > > form=SQLFORM.grid( db.t_member.f_User==t.f_User, > args=request.args[:2], csv=False, > searchable=True, deletable=False, details=False, editable=False, > oncreate=add_handler, > fields=[db.t_member.f_Member_ID, db.t_member.f_FirstName, > db.t_member.f_LastName] ) > > - Scott > -- 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.