[web2py] Re: SQLFORM.grid search with fields readable = False

2019-11-04 Thread cdbaron
It works,

but the solution is db.table.field.listable = False to hide fields in the 
gridand search, db.table.field.readable = False to hide fields and not 
search and db.table.field.searchable = False to show Fields in grid and not 
search.

El viernes, 1 de noviembre de 2019, 16:52:04 (UTC+1), Paul Ellis escribió:
>
> If you want the fields to be searchable. Then instead of setting readable 
> = false. 
>
> Hide the fields with:
>
> db.table.field.represent = lambda value, row: DIV(value, _class='hidden')
>
> and the column heading with:
>
> grid = SQLFORM.grid(
> headers = {
>  'table.field' : DIV(_style = "display:None"),
> }
> )
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0a6b5dc0-767f-4ca5-9832-8c4cba55abc0%40googlegroups.com.


[web2py] Re: SQLFORM.grid search with fields readable = False

2019-11-01 Thread Paul Ellis
If you want the fields to be searchable. Then instead of setting readable = 
false. 

Hide the fields with:

db.table.field.represent = lambda value, row: DIV(value, _class='hidden')

and the column heading with:

grid = SQLFORM.grid(
headers = {
 'table.field' : DIV(_style = "display:None"),
}
)


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2d4d200a-56f5-4a9b-b66f-91a5e7748e9c%40googlegroups.com.


[web2py] Re: SQLFORM.grid search with fields readable = False

2019-10-30 Thread cdbaron

>
> This is my code
>

def federados():

# Tablas de la BBDD
t_licencias = db.t_licencias
t_licencias_agrupaciones = db.t_licencias_agrupaciones
t_federados = db.t_federados

# Campos del grid
fields = [
t_federados.id,
t_federados.f_foto,
t_federados.f_fecha_nacimiento,
t_federados.f_dni,
t_federados.f_pasaporte,
t_federados.f_nombre,
t_federados.f_apellido1,
t_federados.f_apellido2,
t_federados.f_nacionalidad,
t_federados.f_direccion,
t_federados.f_poblacion,
t_federados.f_provincia,
t_federados.f_pais,
t_federados.f_codigo_postal,
t_federados.f_telefono_fijo,
t_federados.f_telefono_movil,
t_federados.f_email,
]

# Campos ocultos
t_federados.f_foto.readable = False
t_federados.f_fecha_nacimiento.readable = False
t_federados.f_dni.readable = False
t_federados.f_pasaporte.readable = False
t_federados.f_nombre.readable = False
t_federados.f_apellido1.readable = False
t_federados.f_apellido2.readable = False
t_federados.f_nacionalidad.readable = False
t_federados.f_direccion.readable = False
t_federados.f_poblacion.readable = False
t_federados.f_provincia.readable = False
t_federados.f_pais.readable = False
t_federados.f_codigo_postal.readable = False
t_federados.f_telefono_fijo.readable = False
t_federados.f_telefono_movil.readable = False
t_federados.f_email.readable = False

def represent_federado(f, r):

represent = DIV(_class="row")

nacimiento = Fechas.nacimiento_edad(r.f_fecha_nacimiento)
nombre = f'{r.f_apellido1} {r.f_apellido2}, {r.f_nombre}'

# foto
represent.insert(0, IMG(_height='100', _width='75', 
_class='grid-foto m-1',
_src=URL(c='federados', f='download', 
args=r.f_foto)))

represent.append(CAT(
DIV(
DIV(nombre), DIV(r.f_dni), DIV(r.f_nacionalidad), 
DIV(nacimiento),
_class='grid-datos-federado m-1'),
))

represent.append(CAT(
DIV(
DIV(r.f_telefono_fijo), DIV(r.f_telefono_movil), 
DIV(r.f_email),
_class='grid-datos-federado m-1'),
))

return represent

   
id_entidad = auth.user.f_id_entidad

query = (t_licencias.f_id_entidad == id_entidad) & \
(t_licencias_agrupaciones.f_id_temporada == temporada_actual.id)

left = [
t_licencias_agrupaciones.on((t_licencias_agrupaciones.f_id_federado 
== t_federados.id)),
t_licencias.on(t_licencias.f_id_agrupacion == 
t_licencias_agrupaciones.id),
]

groupby = [t_licencias_agrupaciones.f_id_federado]
orderby = [t_federados.f_apellido1, t_federados.f_apellido2, 
t_federados.f_nombre]
   
t_federados.id.represent = lambda f, r: represent_federado(f, r)
t_federados.id.label = T('Datos de los federados')

grid = SQLFORM.grid(query,
fields=fields,
field_id=db.t_federados.id,
left=left,
groupby=groupby,
orderby=orderby,
paginate=10,
advanced_search=False,
deletable=False,
editable=False,
details=False,
create=False,
csv=False)

return dict(grid=grid)

 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/75b80fb4-c5b3-4eab-b88e-2bcf83252450%40googlegroups.com.


[web2py] Re: SQLFORM.grid search widget width

2018-10-04 Thread Θωμάς Γκλεζάκος
Regardless -  I think I found it:

Putting the following in the corresponding view does the trick:


jQuery(document).ready(function(){
jQuery('#w2p_keywords').css('width', '900px');
});


P.S. For anyone interested: In order to manipulate the object, you need to 
know its id so as to pass it to a jQuery statement. Well, I found the id of 
the object in question (w2p_keywords) using firefox developer tools 
(pressing F12 while on the said page).


On Thursday, October 4, 2018 at 3:25:15 AM UTC+3, Θωμάς Γκλεζάκος wrote:
>
> Could someone please help me alter the width of the default field of the 
> search widget in SQLFORM.grid?
>
> Thank you in advance for your time
>
> Thomas.
>

-- 
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.


Re: [web2py] Re: SQLFORM.grid search type error reduce()

2017-08-07 Thread Paul Ellis
I will gladly test. But I can't do it until next week. 

⁣Sent from TypeApp ​

On 4 Aug. 2017, 17:58, at 17:58, Massimo Di Pierro  
wrote:
>Just fixed in trunk. Can you please help test the fix?
>
>On Tuesday, 1 August 2017 03:46:13 UTC-5, Paul Ellis wrote:
>>
>> I am getting this error only when searching the auth_membership table
>>
>> I have put in a basic 'appadmin' in my webapp. I call it 'tooladmin'
>to 
>> differentiate from the built in stuff.
>>
>> I use this function to edit any database table:
>> def manage_table():
>> tablename = request.args(0)
>> pagetitle = H4('{0} {1}'.format(T('Manage'), tablename))
>> buttongroup = [_btn_index()]
>> table = db[tablename]
>> pagecontent = SQLFORM.grid(table, args=[request.args(0)])
>>
>>
>> response.view = 'tooladmin_core.html'
>> return dict(pagetitle=pagetitle, buttongroup=buttongroup, 
>> pagecontent=pagecontent)
>>
>> The search feature on the SQLFORM.grid is throwing this error when 
>> searching the auth_membership table:
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>>
>> Traceback (most recent call last):
>>   File "E:\web2py\gluon\restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "E:/web2py/applications/OfferTool/controllers/tooladmin.py"
>,
>line 262, in 
>>   File "E:\web2py\gluon\globals.py", line 417, in 
>> self._caller = lambda f: f()
>>   File "E:/web2py/applications/OfferTool/controllers/tooladmin.py"
>,
>line 136, in manage_table
>> pagecontent = SQLFORM.grid(table, args=[request.args(0)])
>>   File "E:\web2py\gluon\sqlhtml.py", line 2526, in grid
>> subquery = SQLFORM.build_query(sfields, keywords)
>>   File "E:\web2py\gluon\sqlhtml.py", line 1827, in build_query
>> ) for k in key.split()])
>> TypeError: reduce() of empty sequence with no initial value
>>
>>
>>
>>
>
>-- 
>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 a topic in the
>Google Groups "web2py-users" group.
>To unsubscribe from this topic, visit
>https://groups.google.com/d/topic/web2py/UnN6AyOh2Lg/unsubscribe.
>To unsubscribe from this group and all its topics, send an email to
>web2py+unsubscr...@googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
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 type error reduce()

2017-08-04 Thread Massimo Di Pierro
Just fixed in trunk. Can you please help test the fix?

On Tuesday, 1 August 2017 03:46:13 UTC-5, Paul Ellis wrote:
>
> I am getting this error only when searching the auth_membership table
>
> I have put in a basic 'appadmin' in my webapp. I call it 'tooladmin' to 
> differentiate from the built in stuff.
>
> I use this function to edit any database table:
> def manage_table():
> tablename = request.args(0)
> pagetitle = H4('{0} {1}'.format(T('Manage'), tablename))
> buttongroup = [_btn_index()]
> table = db[tablename]
> pagecontent = SQLFORM.grid(table, args=[request.args(0)])
>
>
> response.view = 'tooladmin_core.html'
> return dict(pagetitle=pagetitle, buttongroup=buttongroup, 
> pagecontent=pagecontent)
>
> The search feature on the SQLFORM.grid is throwing this error when 
> searching the auth_membership table:
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
>
> Traceback (most recent call last):
>   File "E:\web2py\gluon\restricted.py", line 227, in restricted
> exec ccode in environment
>   File "E:/web2py/applications/OfferTool/controllers/tooladmin.py" 
> , line 
> 262, in 
>   File "E:\web2py\gluon\globals.py", line 417, in 
> self._caller = lambda f: f()
>   File "E:/web2py/applications/OfferTool/controllers/tooladmin.py" 
> , line 
> 136, in manage_table
> pagecontent = SQLFORM.grid(table, args=[request.args(0)])
>   File "E:\web2py\gluon\sqlhtml.py", line 2526, in grid
> subquery = SQLFORM.build_query(sfields, keywords)
>   File "E:\web2py\gluon\sqlhtml.py", line 1827, in build_query
> ) for k in key.split()])
> TypeError: reduce() of empty sequence with no initial value
>
>
>
>

-- 
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

2016-12-03 Thread Anthony
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] Re: SQLFORM.grid: search in a list:reference field does not work

2016-09-15 Thread St. Pirsch
Although there is a "in", "contains" and "not in" now in the grid search 
operator field, 'list:reference' - fields are not listed in the table 
columns dropdown. Will it be possible to employ such operations with the 
grid widget?  

Am Dienstag, 5. April 2016 03:57:53 UTC+2 schrieb Massimo Di Pierro:
>
> this should be fixed in trunk, we will release a new version.
>
> On Sunday, 3 April 2016 02:21:38 UTC-5, Lionel Roubeyrie wrote:
>>
>> Hi all,
>> I just start with this great framework and I have a similar issue. In a 
>> table there's two 'list:reference' Fields but none is searchable in the 
>> grid view. 
>> Is there some special things to do before?
>>
>> Le dimanche 8 novembre 2015 10:53:35 UTC+1, mweissen a écrit :
>>>
>>> I have a table like
>>>
>>> db.define_table("mytable",
>>> Field("reffield", "list:reference anothertable"),
>>> )
>>>
>>> The search widget of SQLFORM.grid("mytable", ...) does not show the 
>>> reffield.
>>>
>>> In gloun/sqlhtml.py I have found 
>>>
>>> if fields[0]._db._adapter.dbengine == 'google:datastore':
>>>search_options['string'] = ['=', '!=', '<', '>', '<=', '>=']
>>>search_options['text'] = ['=', '!=', '<', '>', '<=', '>=']
>>>search_options['list:string'] = ['contains']
>>>search_options['list:integer'] = ['contains']
>>>search_options['list:reference'] = ['contains']
>>>
>>> Therefore a list:reference field will only be recognized if the table is 
>>> stored in a google:datastore.
>>> Is this an intended behaviour?
>>>
>>> Regards, Martin
>>>
>>>
>>>
>>>
>>>

-- 
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 in a list:reference field does not work

2016-08-11 Thread St. Pirsch
Hello, has this already been updated. It seems that in the current version 
it is still not possible. Is there a way to enable it by altering sqlhtml.py  
for instance?
Would be very helpful to use this feature.
Thanks, Stephan

Am Dienstag, 5. April 2016 03:57:53 UTC+2 schrieb Massimo Di Pierro:
>
> this should be fixed in trunk, we will release a new version.
>
> On Sunday, 3 April 2016 02:21:38 UTC-5, Lionel Roubeyrie wrote:
>>
>> Hi all,
>> I just start with this great framework and I have a similar issue. In a 
>> table there's two 'list:reference' Fields but none is searchable in the 
>> grid view. 
>> Is there some special things to do before?
>>
>> Le dimanche 8 novembre 2015 10:53:35 UTC+1, mweissen a écrit :
>>>
>>> I have a table like
>>>
>>> db.define_table("mytable",
>>> Field("reffield", "list:reference anothertable"),
>>> )
>>>
>>> The search widget of SQLFORM.grid("mytable", ...) does not show the 
>>> reffield.
>>>
>>> In gloun/sqlhtml.py I have found 
>>>
>>> if fields[0]._db._adapter.dbengine == 'google:datastore':
>>>search_options['string'] = ['=', '!=', '<', '>', '<=', '>=']
>>>search_options['text'] = ['=', '!=', '<', '>', '<=', '>=']
>>>search_options['list:string'] = ['contains']
>>>search_options['list:integer'] = ['contains']
>>>search_options['list:reference'] = ['contains']
>>>
>>> Therefore a list:reference field will only be recognized if the table is 
>>> stored in a google:datastore.
>>> Is this an intended behaviour?
>>>
>>> Regards, Martin
>>>
>>>
>>>
>>>
>>>

-- 
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 in a list:reference field does not work

2016-04-06 Thread villas
But the standard grid search widget never allowed for searching 'list:*' 
fields (except for google:datastore).  
Correct me if I'm wrong...

-- 
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 in a list:reference field does not work

2016-04-03 Thread Lionel Roubeyrie
Hi all,
I just start with this great framework and I have a similar issue. In a 
table there's two 'list:reference' Fields but none is searchable in the 
grid view. 
Is there some special things to do before?

Le dimanche 8 novembre 2015 10:53:35 UTC+1, mweissen a écrit :
>
> I have a table like
>
> db.define_table("mytable",
> Field("reffield", "list:reference anothertable"),
> )
>
> The search widget of SQLFORM.grid("mytable", ...) does not show the 
> reffield.
>
> In gloun/sqlhtml.py I have found 
>
> if fields[0]._db._adapter.dbengine == 'google:datastore':
>search_options['string'] = ['=', '!=', '<', '>', '<=', '>=']
>search_options['text'] = ['=', '!=', '<', '>', '<=', '>=']
>search_options['list:string'] = ['contains']
>search_options['list:integer'] = ['contains']
>search_options['list:reference'] = ['contains']
>
> Therefore a list:reference field will only be recognized if the table is 
> stored in a google:datastore.
> Is this an intended behaviour?
>
> Regards, Martin
>
>
>
>
>

-- 
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.


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2016-03-12 Thread Ashokkumar Nagarajan
Hi,

I am new to Web2Py. Currently I am stuck with this issue.

Any fix available for this issue ? Or anybody found any work around ?

Thanks,
Ashok

On Friday, December 19, 2014 at 8:53:58 AM UTC-5, Paolo Valleri wrote:
>
> Hi, I create a PR https://github.com/web2py/web2py/pull/569 for this issue
>
>  Paolo
>
> 2014-11-28 17:10 GMT+01:00 Alen Cerovic  >:
>>
>> bump, any news? This is really anoying not to be able to preserve vars as 
>> we can args
>>
>> Dana petak, 24. listopada 2014. 21:47:38 UTC+2, korisnik Alen Cerovic 
>> napisao je:
>>
>>> I am on the same boat, any solutions?
>>>
>>> Dana subota, 18. listopada 2014. 20:57:46 UTC+2, korisnik Alfonso de la 
>>> Guarda Reyes napisao je:

 Hi,

 Any change about this? or at lesat how to solve?


 El jueves, 8 de mayo de 2014 03:22:14 UTC-5, Paolo Valleri escribió:
>
> I opened an issue https://code.google.com/
> p/web2py/issues/detail?id=1931
>
>
> On Wednesday, May 7, 2014 3:24:38 PM UTC+2, Anthony wrote:
>>
>> On Wednesday, May 7, 2014 4:00:33 AM UTC-4, Paolo Valleri wrote:
>>>
>>> The workaround of the hidden fields seems to be much more complex 
>>> for this simple issue, isn't it?
>>> In this specific case, we make a search in my point of view the most 
>>> appropriate action should be a POST since we submit data to be 
>>> processed. A 
>>> drawback of that change will be that with the post, a user is not able 
>>> to 
>>> bookmark the search result.
>>>
>>
>> In addition to not allowing bookmarking, POST will cause problems if 
>> the user does a refresh or hits the back button (i.e., the browser will 
>> ask 
>> if you want to re-submit the form data). Anyway, I think the hidden 
>> fields 
>> could be added with a few lines of code, so shouldn't be too complex.
>>
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/xlQfmCUZci0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 in a list:reference field does not work

2015-11-09 Thread Dave S
On Sunday, November 8, 2015 at 10:23:36 AM UTC-8, mweissen wrote:
>
> I have tried it again: without any changes - now I get the correct 
> answers. 
> At this time it is not clear what has happened.
>
> Sorry 
>
>
Thanks for the update.  Let us know if something else turns up.

/dps

 

> 2015-11-08 10:52 GMT+01:00 Martin Weissenboeck  >:
>
>> I have a table like
>>
>> db.define_table("mytable",
>> Field("reffield", "list:reference anothertable"),
>> )
>>
>> The search widget of SQLFORM.grid("mytable", ...) does not show the 
>> reffield.
>>
>> In gloun/sqlhtml.py I have found 
>>
>> if fields[0]._db._adapter.dbengine == 'google:datastore':
>>search_options['string'] = ['=', '!=', '<', '>', '<=', '>=']
>>search_options['text'] = ['=', '!=', '<', '>', '<=', '>=']
>>search_options['list:string'] = ['contains']
>>search_options['list:integer'] = ['contains']
>>search_options['list:reference'] = ['contains']
>>
>> Therefore a list:reference field will only be recognized if the table is 
>> stored in a google:datastore.
>> Is this an intended behaviour?
>>
>> Regards, Martin
>>
>>

-- 
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 in a list:reference field does not work

2015-11-08 Thread Martin Weissenboeck
I have tried it again: without any changes - now I get the correct answers.
At this time it is not clear what has happened.

Sorry 

2015-11-08 10:52 GMT+01:00 Martin Weissenboeck :

> I have a table like
>
> db.define_table("mytable",
> Field("reffield", "list:reference anothertable"),
> )
>
> The search widget of SQLFORM.grid("mytable", ...) does not show the
> reffield.
>
> In gloun/sqlhtml.py I have found
>
> if fields[0]._db._adapter.dbengine == 'google:datastore':
>search_options['string'] = ['=', '!=', '<', '>', '<=', '>=']
>search_options['text'] = ['=', '!=', '<', '>', '<=', '>=']
>search_options['list:string'] = ['contains']
>search_options['list:integer'] = ['contains']
>search_options['list:reference'] = ['contains']
>
> Therefore a list:reference field will only be recognized if the table is
> stored in a google:datastore.
> Is this an intended behaviour?
>
> Regards, Martin
>
>

-- 
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 with multiple terms

2015-03-10 Thread Massimo Di Pierro
please open a ticket. We need to check this. Can you also post your model?

On Monday, 9 March 2015 15:09:23 UTC-5, Ian Holser wrote:

 The search function on SQLFORM grid works fine for single terms, but when 
 typing multiple terms, it doesn't seem to work.

 For example:
 If I have a field value of 'example example1', it will find it with a 
 search for 'example' or 'example1'.  A search for 'example example1' comes 
 up with the whole list (no search performed)

 What is causing this behavior and can it be fixed?

 Thanks,
 Ian Holser


-- 
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 with multiple terms

2015-03-10 Thread Ian Holser
I found a previous thread that solved my issue. 
 https://groups.google.com/forum/#!msg/web2py/9_1ECdKHKUo/8OISg7o8OVIJ
The search bar does not behave as most users would expect.  The ability to 
type multiple words into the search, but not be considered a valid query is 
problematic.  My changes to css had obscured the 'invalid query' text.
I do like the query builder search functionality, but the search bar really 
should behave in a way that normal users would expect.

-- 
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.


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2014-12-19 Thread Paolo Valleri
Hi, I create a PR https://github.com/web2py/web2py/pull/569 for this issue

 Paolo

2014-11-28 17:10 GMT+01:00 Alen Cerovic cerovic.a...@gmail.com:

 bump, any news? This is really anoying not to be able to preserve vars as
 we can args

 Dana petak, 24. listopada 2014. 21:47:38 UTC+2, korisnik Alen Cerovic
 napisao je:

 I am on the same boat, any solutions?

 Dana subota, 18. listopada 2014. 20:57:46 UTC+2, korisnik Alfonso de la
 Guarda Reyes napisao je:

 Hi,

 Any change about this? or at lesat how to solve?


 El jueves, 8 de mayo de 2014 03:22:14 UTC-5, Paolo Valleri escribió:

 I opened an issue https://code.google.com/
 p/web2py/issues/detail?id=1931


 On Wednesday, May 7, 2014 3:24:38 PM UTC+2, Anthony wrote:

 On Wednesday, May 7, 2014 4:00:33 AM UTC-4, Paolo Valleri wrote:

 The workaround of the hidden fields seems to be much more complex for
 this simple issue, isn't it?
 In this specific case, we make a search in my point of view the most
 appropriate action should be a POST since we submit data to be 
 processed. A
 drawback of that change will be that with the post, a user is not able to
 bookmark the search result.


 In addition to not allowing bookmarking, POST will cause problems if
 the user does a refresh or hits the back button (i.e., the browser will 
 ask
 if you want to re-submit the form data). Anyway, I think the hidden fields
 could be added with a few lines of code, so shouldn't be too complex.

 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/xlQfmCUZci0/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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.


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2014-11-28 Thread Alen Cerovic
bump, any news? This is really anoying not to be able to preserve vars as 
we can args

Dana petak, 24. listopada 2014. 21:47:38 UTC+2, korisnik Alen Cerovic 
napisao je:

 I am on the same boat, any solutions?

 Dana subota, 18. listopada 2014. 20:57:46 UTC+2, korisnik Alfonso de la 
 Guarda Reyes napisao je:

 Hi,

 Any change about this? or at lesat how to solve?


 El jueves, 8 de mayo de 2014 03:22:14 UTC-5, Paolo Valleri escribió:

 I opened an issue https://code.google.com/p/web2py/issues/detail?id=1931


 On Wednesday, May 7, 2014 3:24:38 PM UTC+2, Anthony wrote:

 On Wednesday, May 7, 2014 4:00:33 AM UTC-4, Paolo Valleri wrote:

 The workaround of the hidden fields seems to be much more complex for 
 this simple issue, isn't it?
 In this specific case, we make a search in my point of view the most 
 appropriate action should be a POST since we submit data to be processed. 
 A 
 drawback of that change will be that with the post, a user is not able to 
 bookmark the search result.


 In addition to not allowing bookmarking, POST will cause problems if 
 the user does a refresh or hits the back button (i.e., the browser will 
 ask 
 if you want to re-submit the form data). Anyway, I think the hidden fields 
 could be added with a few lines of code, so shouldn't be too complex.

 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.


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2014-10-24 Thread Alen Cerovic
I am on the same boat, any solutions?

Dana subota, 18. listopada 2014. 20:57:46 UTC+2, korisnik Alfonso de la 
Guarda Reyes napisao je:

 Hi,

 Any change about this? or at lesat how to solve?


 El jueves, 8 de mayo de 2014 03:22:14 UTC-5, Paolo Valleri escribió:

 I opened an issue https://code.google.com/p/web2py/issues/detail?id=1931


 On Wednesday, May 7, 2014 3:24:38 PM UTC+2, Anthony wrote:

 On Wednesday, May 7, 2014 4:00:33 AM UTC-4, Paolo Valleri wrote:

 The workaround of the hidden fields seems to be much more complex for 
 this simple issue, isn't it?
 In this specific case, we make a search in my point of view the most 
 appropriate action should be a POST since we submit data to be processed. 
 A 
 drawback of that change will be that with the post, a user is not able to 
 bookmark the search result.


 In addition to not allowing bookmarking, POST will cause problems if the 
 user does a refresh or hits the back button (i.e., the browser will ask if 
 you want to re-submit the form data). Anyway, I think the hidden fields 
 could be added with a few lines of code, so shouldn't be too complex.

 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.


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2014-10-18 Thread Alfonso de la Guarda Reyes
Hi,

Any change about this? or at lesat how to solve?


El jueves, 8 de mayo de 2014 03:22:14 UTC-5, Paolo Valleri escribió:

 I opened an issue https://code.google.com/p/web2py/issues/detail?id=1931


 On Wednesday, May 7, 2014 3:24:38 PM UTC+2, Anthony wrote:

 On Wednesday, May 7, 2014 4:00:33 AM UTC-4, Paolo Valleri wrote:

 The workaround of the hidden fields seems to be much more complex for 
 this simple issue, isn't it?
 In this specific case, we make a search in my point of view the most 
 appropriate action should be a POST since we submit data to be processed. A 
 drawback of that change will be that with the post, a user is not able to 
 bookmark the search result.


 In addition to not allowing bookmarking, POST will cause problems if the 
 user does a refresh or hits the back button (i.e., the browser will ask if 
 you want to re-submit the form data). Anyway, I think the hidden fields 
 could be added with a few lines of code, so shouldn't be too complex.

 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: SQLFORM.grid search - boolean precedence? - nested queries?

2014-06-12 Thread Derek
You have your queries all wrong. Can you share your code? You should use 
the python bitwise operators not the words. Also, why are you using 
assignment when you should be testing for equality?

On Thursday, June 12, 2014 2:35:25 PM UTC-7, Vincent wrote:

 How would one go about doing the equivalent of  
 A and (B or C)
 in the grid or smartgrid search?
 Tried reading the source but got lost.

 Given 
 db.person.firstname
 db.person.lastname

 this fails as an invalid query:
 person.firstname = John and (person.lastname = Smith or 
 person.lastname = Williams)

 Boolean precedence also does not seem to be implemented (and before or) as 
 this doesn't return the expected results:
 person.firstname = John and person.lastname = Smith or 
 person.firstname = John and person.lastname = Williams

 Any suggestions?


-- 
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.


Re: [web2py] Re: SQLFORM.grid search - boolean precedence? - nested queries?

2014-06-12 Thread Vincent Chevrier
I guess I wasn't clear enough, my example queries are not python code, they
are text that would be entered in the search box in the default search
widget generated by SQLFORM.grid.

I know how to do it in python code, but I am looking for an answer
regarding if this is possible from the search box (and equivalently
directly by URL)

Thanks
Vincent


On Thu, Jun 12, 2014 at 5:38 PM, Derek sp1d...@gmail.com wrote:

 You have your queries all wrong. Can you share your code? You should use
 the python bitwise operators not the words. Also, why are you using
 assignment when you should be testing for equality?


 On Thursday, June 12, 2014 2:35:25 PM UTC-7, Vincent wrote:

 How would one go about doing the equivalent of
 A and (B or C)
 in the grid or smartgrid search?
 Tried reading the source but got lost.

 Given
 db.person.firstname
 db.person.lastname

 this fails as an invalid query:
 person.firstname = John and (person.lastname = Smith or
 person.lastname = Williams)

 Boolean precedence also does not seem to be implemented (and before or)
 as this doesn't return the expected results:
 person.firstname = John and person.lastname = Smith or
 person.firstname = John and person.lastname = Williams

 Any suggestions?

  --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/2stnvKwdHaY/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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.


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2014-05-08 Thread Paolo Valleri
I opened an issue https://code.google.com/p/web2py/issues/detail?id=1931


On Wednesday, May 7, 2014 3:24:38 PM UTC+2, Anthony wrote:

 On Wednesday, May 7, 2014 4:00:33 AM UTC-4, Paolo Valleri wrote:

 The workaround of the hidden fields seems to be much more complex for 
 this simple issue, isn't it?
 In this specific case, we make a search in my point of view the most 
 appropriate action should be a POST since we submit data to be processed. A 
 drawback of that change will be that with the post, a user is not able to 
 bookmark the search result.


 In addition to not allowing bookmarking, POST will cause problems if the 
 user does a refresh or hits the back button (i.e., the browser will ask if 
 you want to re-submit the form data). Anyway, I think the hidden fields 
 could be added with a few lines of code, so shouldn't be too complex.

 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.


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2014-05-07 Thread Paolo Valleri
The workaround of the hidden fields seems to be much more complex for this
simple issue, isn't it?
In this specific case, we make a search in my point of view the most
appropriate action should be a POST since we submit data to be processed. A
drawback of that change will be that with the post, a user is not able to
bookmark the search result.

 Paolo


2014-05-06 20:55 GMT+02:00 Anthony abasta...@gmail.com:

 I think when the browser makes the request, it strips any existing query
 string from the form action and replaces it with a query string containing
 the form data. A workaround would be to include hidden fields in the form
 that contain the original query string variables. This could be done in the
 server side code or via JavaScript. The advantage of the latter is that it
 could more easily be made to work with custom search widgets (also possible
 on the server side, but would be difficult if the custom widget is not a
 web2py FORM object).

 Maybe submit a Google issue and link to this thread.

 Anthony


 On Monday, May 5, 2014 8:28:41 AM UTC-4, Paolo Valleri wrote:

 Dear all,
 I've implemented a method which uses SQLFORM.grid to show a subset of a
 given table. The query that defines the subset is built using a variable
 passed to the method through request.vars.*.
 Everything works as expected but search, namely when I type search for
 something all former request.vars are erased.
 Actually the action url of the form is correct it has all request.vars
 variable plus the signature, when I type search all of them are replaced by
 the variable 'keywords'
 Is this the expected behavior for SQLFORM.grid search?

 Regards
 Paolo

  --
 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/xlQfmCUZci0/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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.


Re: [web2py] Re: SQLFORM.grid search with custom request.vars

2014-05-07 Thread Anthony
On Wednesday, May 7, 2014 4:00:33 AM UTC-4, Paolo Valleri wrote:

 The workaround of the hidden fields seems to be much more complex for this 
 simple issue, isn't it?
 In this specific case, we make a search in my point of view the most 
 appropriate action should be a POST since we submit data to be processed. A 
 drawback of that change will be that with the post, a user is not able to 
 bookmark the search result.


In addition to not allowing bookmarking, POST will cause problems if the 
user does a refresh or hits the back button (i.e., the browser will ask if 
you want to re-submit the form data). Anyway, I think the hidden fields 
could be added with a few lines of code, so shouldn't be too complex.

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: SQLFORM.grid search with custom request.vars

2014-05-06 Thread Anthony
I think when the browser makes the request, it strips any existing query 
string from the form action and replaces it with a query string containing 
the form data. A workaround would be to include hidden fields in the form 
that contain the original query string variables. This could be done in the 
server side code or via JavaScript. The advantage of the latter is that it 
could more easily be made to work with custom search widgets (also possible 
on the server side, but would be difficult if the custom widget is not a 
web2py FORM object).

Maybe submit a Google issue and link to this thread.

Anthony

On Monday, May 5, 2014 8:28:41 AM UTC-4, Paolo Valleri wrote:

 Dear all,
 I've implemented a method which uses SQLFORM.grid to show a subset of a 
 given table. The query that defines the subset is built using a variable 
 passed to the method through request.vars.*.
 Everything works as expected but search, namely when I type search for 
 something all former request.vars are erased.
 Actually the action url of the form is correct it has all request.vars 
 variable plus the signature, when I type search all of them are replaced by 
 the variable 'keywords'
 Is this the expected behavior for SQLFORM.grid search?

 Regards
 Paolo


-- 
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

2014-02-19 Thread horridohobbyist
I tried this. It returns empty on grid.element('#w2p_directory_keywords').

Not that it matters. I've decided to keep the Search function as is.


On Monday, 17 February 2014 23:18:28 UTC-5, Anthony wrote:

 Note, if you don't want to create a new search widget but just want to 
 remove the default Javascript widget and instead have a basic search input 
 field, you can do:

 search_input = grid.element('#w2p_directory_keywords')
 search_input and search_input.attributes.pop('_onfocus')

 That simply removes the _onfocus event handler, which disables the 
 Javascript functionality of the widget.

 Anthony

 On Monday, February 17, 2014 11:12:52 PM UTC-5, Anthony wrote:

 Yes. The searchable argument can be a callable that builds a query 
 based on the keywords, and there is a search_widget argument you can use 
 to generate a custom search widget. I suggest you check out the 
 SQLFORM.grid code in gluon.sqlhtml to see how they work.

 Anthony

 On Monday, February 17, 2014 11:02:03 PM UTC-5, horridohobbyist wrote:

 I'm using SQLFORM.grid for my application. It's very powerful and saves 
 me a lot of work. However, I would like to alter/customize the search 
 function in the grid. Is there a way for me to do this?

 Thanks.



-- 
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/groups/opt_out.


[web2py] Re: SQLFORM.grid Search

2014-02-19 Thread Anthony
Looks like it has been changed to #w2p_keywords. Anyway, it may be better 
to use the name attribute:

grid.element(_name='keywords')

Anthony

On Wednesday, February 19, 2014 7:44:36 AM UTC-5, horridohobbyist wrote:

 I tried this. It returns empty on grid.element('#w2p_directory_keywords').

 Not that it matters. I've decided to keep the Search function as is.


 On Monday, 17 February 2014 23:18:28 UTC-5, Anthony wrote:

 Note, if you don't want to create a new search widget but just want to 
 remove the default Javascript widget and instead have a basic search input 
 field, you can do:

 search_input = grid.element('#w2p_directory_keywords')
 search_input and search_input.attributes.pop('_onfocus')

 That simply removes the _onfocus event handler, which disables the 
 Javascript functionality of the widget.

 Anthony

 On Monday, February 17, 2014 11:12:52 PM UTC-5, Anthony wrote:

 Yes. The searchable argument can be a callable that builds a query 
 based on the keywords, and there is a search_widget argument you can use 
 to generate a custom search widget. I suggest you check out the 
 SQLFORM.grid code in gluon.sqlhtml to see how they work.

 Anthony

 On Monday, February 17, 2014 11:02:03 PM UTC-5, horridohobbyist wrote:

 I'm using SQLFORM.grid for my application. It's very powerful and saves 
 me a lot of work. However, I would like to alter/customize the search 
 function in the grid. Is there a way for me to do this?

 Thanks.



-- 
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/groups/opt_out.


[web2py] Re: SQLFORM.grid Search

2014-02-17 Thread Anthony
Yes. The searchable argument can be a callable that builds a query based 
on the keywords, and there is a search_widget argument you can use to 
generate a custom search widget. I suggest you check out the SQLFORM.grid 
code in gluon.sqlhtml to see how they work.

Anthony

On Monday, February 17, 2014 11:02:03 PM UTC-5, horridohobbyist wrote:

 I'm using SQLFORM.grid for my application. It's very powerful and saves me 
 a lot of work. However, I would like to alter/customize the search function 
 in the grid. Is there a way for me to do this?

 Thanks.


-- 
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/groups/opt_out.


[web2py] Re: SQLFORM.grid Search

2014-02-17 Thread Anthony
Note, if you don't want to create a new search widget but just want to 
remove the default Javascript widget and instead have a basic search input 
field, you can do:

search_input = grid.element('#w2p_directory_keywords')
search_input and search_input.attributes.pop('_onfocus')

That simply removes the _onfocus event handler, which disables the 
Javascript functionality of the widget.

Anthony

On Monday, February 17, 2014 11:12:52 PM UTC-5, Anthony wrote:

 Yes. The searchable argument can be a callable that builds a query based 
 on the keywords, and there is a search_widget argument you can use to 
 generate a custom search widget. I suggest you check out the SQLFORM.grid 
 code in gluon.sqlhtml to see how they work.

 Anthony

 On Monday, February 17, 2014 11:02:03 PM UTC-5, horridohobbyist wrote:

 I'm using SQLFORM.grid for my application. It's very powerful and saves 
 me a lot of work. However, I would like to alter/customize the search 
 function in the grid. Is there a way for me to do this?

 Thanks.



-- 
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/groups/opt_out.


[web2py] Re: SQLFORM.grid search widget omits decimal fields. Any reason for this?

2013-04-08 Thread Massimo Di Pierro
Please open a ticket about this. It is an oversight and easy to fix.

On Monday, 8 April 2013 08:43:40 UTC-5, Cliff Kachinske wrote:

 Is there any reason why the default search widget does not include decimal 
 field types?

 In sqlhtml.py v 2.4.2, decimal field types are omitted from the search 
 options dictionary, lines 1619, 1629.

 Likewise in lines 1637 -1731 there is no value_input defined for decimal 
 field types.

 Is there any reason why decimal field types aren't included here?

 Thanks,
 Cliff Kachinske


-- 

--- 
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/groups/opt_out.




[web2py] Re: SQLFORM.grid search widget omits decimal fields. Any reason for this?

2013-04-08 Thread Cliff Kachinske
Done.  Issue 1436.



On Monday, April 8, 2013 10:00:01 AM UTC-4, Massimo Di Pierro wrote:

 Please open a ticket about this. It is an oversight and easy to fix.

 On Monday, 8 April 2013 08:43:40 UTC-5, Cliff Kachinske wrote:

 Is there any reason why the default search widget does not include 
 decimal field types?

 In sqlhtml.py v 2.4.2, decimal field types are omitted from the search 
 options dictionary, lines 1619, 1629.

 Likewise in lines 1637 -1731 there is no value_input defined for decimal 
 field types.

 Is there any reason why decimal field types aren't included here?

 Thanks,
 Cliff Kachinske



-- 

--- 
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/groups/opt_out.




[web2py] Re: SQLFORM.grid search widget omits decimal fields. Any reason for this?

2013-04-08 Thread Cliff Kachinske
I can provide a patch.  Should I do the diff against trunk or stable or 
nightly build?

On Monday, April 8, 2013 10:40:04 AM UTC-4, Cliff Kachinske wrote:

 Done.  Issue 1436.



 On Monday, April 8, 2013 10:00:01 AM UTC-4, Massimo Di Pierro wrote:

 Please open a ticket about this. It is an oversight and easy to fix.

 On Monday, 8 April 2013 08:43:40 UTC-5, Cliff Kachinske wrote:

 Is there any reason why the default search widget does not include 
 decimal field types?

 In sqlhtml.py v 2.4.2, decimal field types are omitted from the search 
 options dictionary, lines 1619, 1629.

 Likewise in lines 1637 -1731 there is no value_input defined for decimal 
 field types.

 Is there any reason why decimal field types aren't included here?

 Thanks,
 Cliff Kachinske



-- 

--- 
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/groups/opt_out.




[web2py] Re: SQLFORM.grid search widget omits decimal fields. Any reason for this?

2013-04-08 Thread Massimo Di Pierro
Always trunk. Please.

On Monday, 8 April 2013 10:25:13 UTC-5, Cliff Kachinske wrote:

 I can provide a patch.  Should I do the diff against trunk or stable or 
 nightly build?

 On Monday, April 8, 2013 10:40:04 AM UTC-4, Cliff Kachinske wrote:

 Done.  Issue 1436.



 On Monday, April 8, 2013 10:00:01 AM UTC-4, Massimo Di Pierro wrote:

 Please open a ticket about this. It is an oversight and easy to fix.

 On Monday, 8 April 2013 08:43:40 UTC-5, Cliff Kachinske wrote:

 Is there any reason why the default search widget does not include 
 decimal field types?

 In sqlhtml.py v 2.4.2, decimal field types are omitted from the search 
 options dictionary, lines 1619, 1629.

 Likewise in lines 1637 -1731 there is no value_input defined for 
 decimal field types.

 Is there any reason why decimal field types aren't included here?

 Thanks,
 Cliff Kachinske



-- 

--- 
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/groups/opt_out.




[web2py] Re: SQLFORM.grid: search and links

2012-12-07 Thread tomt
I would also like to be able to change the position of the 'links' column.
I see that your post didn't receive any answers. Did you figure out how to 
do this?
If you did, I would appreciate if you could tell me how.

- Tom

On Sunday, January 29, 2012 4:33:21 PM UTC-6, backseat wrote:

 I've a couple of questions about SQLFORM.grid:

  - Is it possible to position the buttons/links created by the 'links' 
 argument somewhere other than the end of the row? It feels as if the 
 'fields' argument should be able to do this, but I can't see how.

  - Is it possible for the 'search' box to search linked tables? That may 
 be asking a bit much...

 Thanks


-- 





[web2py] Re: SQLFORM.grid: search and links

2012-12-07 Thread tomt
After some more investigation I found out that the latest trunk has the 
added options:
 buttons_placement = 
'right',   ):
 links_placement = 'right' 

With this option I can set links_placement ='left'  which results in the 
'links' column appearing on the first column.

Great, problem solved.

On Friday, December 7, 2012 10:02:53 PM UTC-6, tomt wrote:

 I would also like to be able to change the position of the 'links' column.
 I see that your post didn't receive any answers. Did you figure out how to 
 do this?
 If you did, I would appreciate if you could tell me how.

 - Tom

 On Sunday, January 29, 2012 4:33:21 PM UTC-6, backseat wrote:

 I've a couple of questions about SQLFORM.grid:

  - Is it possible to position the buttons/links created by the 'links' 
 argument somewhere other than the end of the row? It feels as if the 
 'fields' argument should be able to do this, but I can't see how.

  - Is it possible for the 'search' box to search linked tables? That may 
 be asking a bit much...

 Thanks



-- 





Re: [web2py] Re: sqlform.grid search widget

2012-09-04 Thread peter
Here is an update on the search widget.
The solution above does not work if the found results spread over several 
pages. The search is lost on the extra pages.

The solution to this is to change all occurrences of 'search_text' appear 
in the request with 'keywords'

def search_form(self,url): 
form = FORM('', 
  
INPUT(_name='search_text',_value=request.get_vars.keywords, 
   _style='width:200px;', 
   _id='searchText'), 
 INPUT(_type='submit',_value=T('Search')), 
 INPUT(_type='submit',_value=T('Clear'), 
 _onclick=jQuery('#keywords').val('');), 
 _method=GET,_action=url) 

return form 

def search_query(tableid,search_text,fields): 
words= search_text.split(' ') if search_text else [] 
query=tableid0#empty query 
for field in fields: 
new_query=tableid0 
for word in words: 
new_query=new_queryfield.contains(word) 
query=query|new_query 
return query 

Then in the function that has the sqlform.grid call, before the call 
add 

search_text=request.get_vars.keywords 
query=search_query(db.tablea.id,search_text, 
[db.tablea.fielda,db.tablea.fieldb])  

Peter


On Friday, 20 July 2012 22:12:10 UTC+1, Elcimar wrote:

 it works now =) 
 thanks dude
 about the search query
 Found a hack somewhere in the here group telling to delete it directly 
 like:

 del grid[0][2] 

 Em sexta-feira, 20 de julho de 2012 05h29min27s UTC-3, peter escreveu:

 I think that there is an argument for incorporating my solution into the 
 standard sqlform grid and having a flag for switching between the query 
 system or my simple text search. If the table is being presented in a web 
 application for the great web public then they are going to expect searches 
 to be 'google like'.

 Peter

 On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote:

 I think it will solve one of the issue I had with using sqlform.grid in 
 place of sqltable + Datatables. Since Datatables has a pretty simple 
 search/filter and my users knows how to use it than I would not remove this 
 kind of easy search/filter functionality and leave them with only a harder 
 more complex solution, so I stick with sqltable + Datatables even if 
 sqlform.grid is much more interesting...

 Thank Peter.

 Richard

 On Thu, Jul 19, 2012 at 11:00 AM, peter peterchu...@gmail.comjavascript:
  wrote:

 Thanks for this I had not noticed that clear did not work, I guess I 
 never use it.

 The problem is a type in the search_form function

 The fifth line should read

 id = 'search_text'),

 not id='searchText'),


 Does anyone know if I can edit the first message in this topic so as to 
 correct it?

 Peter



 On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote:


 Works like a charm, but the Clear button is working exactly like the 
 Search one, without clearing 'search_text' before submit
 Is there another method to do that?

 Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff 
 Kachinske escreveu:

 Good one.

 You earned a browser bookmark.

 Thanks.

 On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote:

 As I have commented before, sqlform.grid has a particular way of 
 searching. Its combination of search and 'queries' is very powerful. 
 However the search does not really work in the way a casual web user 
 might expect. If entered - Bob Dylan - in the search box and clicked 
 search, then one get 'invalid query'. I eventually worked out how to 
 change the search widget, so as I believe this is currently 
 undocumented I thought I would share it. The semantics I have chosen 
 for search are that it will return records where any of the 
 specified 
 fields (fielda and fieldb in the example) contain all of the words 
 in 
 the search field. i.e if the search term is -Bob Dylan- it will 
 return 
 records that have both Bob and Dylan in the fieldA or both in 
 fieldb. 

 Define a search function that creates the form and a function that 
 does the search 

 def search_form(self,url): 
 form = FORM('', 
   
 INPUT(_name='search_text',_**value=request.get_vars.search_**text, 
_style='width:200px;', 
_id='searchText'), 
  INPUT(_type='submit',_value=**T('Search')), 
  INPUT(_type='submit',_value=**T('Clear'), 
  _onclick=jQuery('#search_**text').val('');), 
  _method=GET,_action=url) 

 return form 

 def search_query(tableid,search_**text,fields): 
 words= search_text.split(' ') if search_text else [] 
 query=tableid0#empty query 
 for field in fields: 
 new_query=tableid0 
 for word in words: 
 new_query=new_queryfield.**contains(word) 
 query=query|new_query 
 return query 

 Then in the function that has the sqlform.grid call, before the call 
 add 

 search_text=request.get_vars.**search_text 
 query=search_query(db.tablea.**id 
 http://db.tablea.id,search_text, 

 

Re: [web2py] Re: sqlform.grid search widget

2012-09-04 Thread peter
Sorry the previous email did not contain the final version. Here it is.

def search_form(self,url): 
form = FORM('', 
  
INPUT(_name='keywords',_value=request.get_vars.keywords, 
   _style='width:200px;', 
   _id='keywords'), 
 INPUT(_type='submit',_value=T('Search')), 
 INPUT(_type='submit',_value=T('Clear'), 
 _onclick=jQuery('#keywords').val('');), 
 _method=GET,_action=url) 

return form 

def search_query(tableid,search_text,fields): 
words= search_text.split(' ') if search_text else [] 
query=tableid0#empty query 
for field in fields: 
new_query=tableid0 
for word in words: 
new_query=new_queryfield.contains(word) 
query=query|new_query 
return query 

Then in the function that has the sqlform.grid call, before the call 
add 

search_text=request.get_vars.keywords 
query=search_query(db.tablea.id,search_text, 
[db.tablea.fielda,db.tablea.fieldb])   

-- 





Re: [web2py] Re: sqlform.grid search widget

2012-07-20 Thread peter
I think that there is an argument for incorporating my solution into the 
standard sqlform grid and having a flag for switching between the query 
system or my simple text search. If the table is being presented in a web 
application for the great web public then they are going to expect searches 
to be 'google like'.

Peter

On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote:

 I think it will solve one of the issue I had with using sqlform.grid in 
 place of sqltable + Datatables. Since Datatables has a pretty simple 
 search/filter and my users knows how to use it than I would not remove this 
 kind of easy search/filter functionality and leave them with only a harder 
 more complex solution, so I stick with sqltable + Datatables even if 
 sqlform.grid is much more interesting...

 Thank Peter.

 Richard

 On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.comwrote:

 Thanks for this I had not noticed that clear did not work, I guess I 
 never use it.

 The problem is a type in the search_form function

 The fifth line should read

 id = 'search_text'),

 not id='searchText'),


 Does anyone know if I can edit the first message in this topic so as to 
 correct it?

 Peter



 On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote:


 Works like a charm, but the Clear button is working exactly like the 
 Search one, without clearing 'search_text' before submit
 Is there another method to do that?

 Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff Kachinske 
 escreveu:

 Good one.

 You earned a browser bookmark.

 Thanks.

 On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote:

 As I have commented before, sqlform.grid has a particular way of 
 searching. Its combination of search and 'queries' is very powerful. 
 However the search does not really work in the way a casual web user 
 might expect. If entered - Bob Dylan - in the search box and clicked 
 search, then one get 'invalid query'. I eventually worked out how to 
 change the search widget, so as I believe this is currently 
 undocumented I thought I would share it. The semantics I have chosen 
 for search are that it will return records where any of the specified 
 fields (fielda and fieldb in the example) contain all of the words in 
 the search field. i.e if the search term is -Bob Dylan- it will return 
 records that have both Bob and Dylan in the fieldA or both in fieldb. 

 Define a search function that creates the form and a function that 
 does the search 

 def search_form(self,url): 
 form = FORM('', 
   
 INPUT(_name='search_text',_**value=request.get_vars.search_**text, 
_style='width:200px;', 
_id='searchText'), 
  INPUT(_type='submit',_value=**T('Search')), 
  INPUT(_type='submit',_value=**T('Clear'), 
  _onclick=jQuery('#search_**text').val('');), 
  _method=GET,_action=url) 

 return form 

 def search_query(tableid,search_**text,fields): 
 words= search_text.split(' ') if search_text else [] 
 query=tableid0#empty query 
 for field in fields: 
 new_query=tableid0 
 for word in words: 
 new_query=new_queryfield.**contains(word) 
 query=query|new_query 
 return query 

 Then in the function that has the sqlform.grid call, before the call 
 add 

 search_text=request.get_vars.**search_text 
 query=search_query(db.tablea.**id http://db.tablea.id,search_text, 

 [db.tablea.fielda,db.tablea.**fieldb]) 
 ... 
 # the query could now be combined with other queries. 

 table=SQLFORM.grid(query, search_widget=search_form.**...) 

 return dict(table=table) 








  -- 
  
  
  




-- 





Re: [web2py] Re: sqlform.grid search widget

2012-07-20 Thread Richard Vézina
Maybe open a issue and summit a patch or your code...

http://code.google.com/p/web2py/issues/list

Richard

On Fri, Jul 20, 2012 at 4:29 AM, peter peterchutchin...@gmail.com wrote:

 I think that there is an argument for incorporating my solution into the
 standard sqlform grid and having a flag for switching between the query
 system or my simple text search. If the table is being presented in a web
 application for the great web public then they are going to expect searches
 to be 'google like'.

 Peter


 On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote:

 I think it will solve one of the issue I had with using sqlform.grid in
 place of sqltable + Datatables. Since Datatables has a pretty simple
 search/filter and my users knows how to use it than I would not remove this
 kind of easy search/filter functionality and leave them with only a harder
 more complex solution, so I stick with sqltable + Datatables even if
 sqlform.grid is much more interesting...

 Thank Peter.

 Richard

 On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.comwrote:

 Thanks for this I had not noticed that clear did not work, I guess I
 never use it.

 The problem is a type in the search_form function

 The fifth line should read

 id = 'search_text'),

 not id='searchText'),


 Does anyone know if I can edit the first message in this topic so as to
 correct it?

 Peter



 On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote:


 Works like a charm, but the Clear button is working exactly like the
 Search one, without clearing 'search_text' before submit
 Is there another method to do that?

 Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff
 Kachinske escreveu:

 Good one.

 You earned a browser bookmark.

 Thanks.

 On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote:

 As I have commented before, sqlform.grid has a particular way of
 searching. Its combination of search and 'queries' is very powerful.
 However the search does not really work in the way a casual web user
 might expect. If entered - Bob Dylan - in the search box and clicked
 search, then one get 'invalid query'. I eventually worked out how to
 change the search widget, so as I believe this is currently
 undocumented I thought I would share it. The semantics I have chosen
 for search are that it will return records where any of the specified
 fields (fielda and fieldb in the example) contain all of the words in
 the search field. i.e if the search term is -Bob Dylan- it will
 return
 records that have both Bob and Dylan in the fieldA or both in fieldb.

 Define a search function that creates the form and a function that
 does the search

 def search_form(self,url):
 form = FORM('',

 INPUT(_name='search_text',_**val**ue=request.get_vars.search_**tex**t,

_style='width:200px;',
_id='searchText'),
  INPUT(_type='submit',_value=**T**('Search')),
  INPUT(_type='submit',_value=**T**('Clear'),
  _onclick=jQuery('#search_**tex**t').val('');),
  _method=GET,_action=url)

 return form

 def search_query(tableid,search_**te**xt,fields):
 words= search_text.split(' ') if search_text else []
 query=tableid0#empty query
 for field in fields:
 new_query=tableid0
 for word in words:
 new_query=new_queryfield.**con**tains(word)
 query=query|new_query
 return query

 Then in the function that has the sqlform.grid call, before the call
 add

 search_text=request.get_vars.**s**earch_text
 query=search_query(db.tablea.**i**d 
 http://db.tablea.id,search_text,

 [db.tablea.fielda,db.tablea.**fi**eldb])
 ...
 # the query could now be combined with other queries.

 table=SQLFORM.grid(query, search_widget=search_form....)

 return dict(table=table)








  --





  --





-- 





Re: [web2py] Re: sqlform.grid search widget

2012-07-20 Thread Elcimar
it works now =) 
thanks dude
about the search query
Found a hack somewhere in the here group telling to delete it directly like:

del grid[0][2] 

Em sexta-feira, 20 de julho de 2012 05h29min27s UTC-3, peter escreveu:

 I think that there is an argument for incorporating my solution into the 
 standard sqlform grid and having a flag for switching between the query 
 system or my simple text search. If the table is being presented in a web 
 application for the great web public then they are going to expect searches 
 to be 'google like'.

 Peter

 On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote:

 I think it will solve one of the issue I had with using sqlform.grid in 
 place of sqltable + Datatables. Since Datatables has a pretty simple 
 search/filter and my users knows how to use it than I would not remove this 
 kind of easy search/filter functionality and leave them with only a harder 
 more complex solution, so I stick with sqltable + Datatables even if 
 sqlform.grid is much more interesting...

 Thank Peter.

 Richard

 On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.comwrote:

 Thanks for this I had not noticed that clear did not work, I guess I 
 never use it.

 The problem is a type in the search_form function

 The fifth line should read

 id = 'search_text'),

 not id='searchText'),


 Does anyone know if I can edit the first message in this topic so as to 
 correct it?

 Peter



 On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote:


 Works like a charm, but the Clear button is working exactly like the 
 Search one, without clearing 'search_text' before submit
 Is there another method to do that?

 Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff 
 Kachinske escreveu:

 Good one.

 You earned a browser bookmark.

 Thanks.

 On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote:

 As I have commented before, sqlform.grid has a particular way of 
 searching. Its combination of search and 'queries' is very powerful. 
 However the search does not really work in the way a casual web user 
 might expect. If entered - Bob Dylan - in the search box and clicked 
 search, then one get 'invalid query'. I eventually worked out how to 
 change the search widget, so as I believe this is currently 
 undocumented I thought I would share it. The semantics I have chosen 
 for search are that it will return records where any of the specified 
 fields (fielda and fieldb in the example) contain all of the words in 
 the search field. i.e if the search term is -Bob Dylan- it will 
 return 
 records that have both Bob and Dylan in the fieldA or both in fieldb. 

 Define a search function that creates the form and a function that 
 does the search 

 def search_form(self,url): 
 form = FORM('', 
   
 INPUT(_name='search_text',_**value=request.get_vars.search_**text, 
_style='width:200px;', 
_id='searchText'), 
  INPUT(_type='submit',_value=**T('Search')), 
  INPUT(_type='submit',_value=**T('Clear'), 
  _onclick=jQuery('#search_**text').val('');), 
  _method=GET,_action=url) 

 return form 

 def search_query(tableid,search_**text,fields): 
 words= search_text.split(' ') if search_text else [] 
 query=tableid0#empty query 
 for field in fields: 
 new_query=tableid0 
 for word in words: 
 new_query=new_queryfield.**contains(word) 
 query=query|new_query 
 return query 

 Then in the function that has the sqlform.grid call, before the call 
 add 

 search_text=request.get_vars.**search_text 
 query=search_query(db.tablea.**id http://db.tablea.id,search_text, 

 [db.tablea.fielda,db.tablea.**fieldb]) 
 ... 
 # the query could now be combined with other queries. 

 table=SQLFORM.grid(query, search_widget=search_form.**...) 

 return dict(table=table) 








  -- 
  
  
  



Em sexta-feira, 20 de julho de 2012 05h29min27s UTC-3, peter escreveu:

 I think that there is an argument for incorporating my solution into the 
 standard sqlform grid and having a flag for switching between the query 
 system or my simple text search. If the table is being presented in a web 
 application for the great web public then they are going to expect searches 
 to be 'google like'.

 Peter

 On Thursday, 19 July 2012 16:22:21 UTC+1, Richard wrote:

 I think it will solve one of the issue I had with using sqlform.grid in 
 place of sqltable + Datatables. Since Datatables has a pretty simple 
 search/filter and my users knows how to use it than I would not remove this 
 kind of easy search/filter functionality and leave them with only a harder 
 more complex solution, so I stick with sqltable + Datatables even if 
 sqlform.grid is much more interesting...

 Thank Peter.

 Richard

 On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.comwrote:

 Thanks for this I had not noticed that clear did not work, I guess I 
 never use it.

 The 

[web2py] Re: sqlform.grid search widget

2012-07-19 Thread peter
Thanks for this I had not noticed that clear did not work, I guess I never 
use it.

The problem is a type in the search_form function

The fifth line should read

id = 'search_text'),

not id='searchText'),


Does anyone know if I can edit the first message in this topic so as to 
correct it?

Peter



On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote:


 Works like a charm, but the Clear button is working exactly like the 
 Search one, without clearing 'search_text' before submit
 Is there another method to do that?

 Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff Kachinske 
 escreveu:

 Good one.

 You earned a browser bookmark.

 Thanks.

 On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote:

 As I have commented before, sqlform.grid has a particular way of 
 searching. Its combination of search and 'queries' is very powerful. 
 However the search does not really work in the way a casual web user 
 might expect. If entered - Bob Dylan - in the search box and clicked 
 search, then one get 'invalid query'. I eventually worked out how to 
 change the search widget, so as I believe this is currently 
 undocumented I thought I would share it. The semantics I have chosen 
 for search are that it will return records where any of the specified 
 fields (fielda and fieldb in the example) contain all of the words in 
 the search field. i.e if the search term is -Bob Dylan- it will return 
 records that have both Bob and Dylan in the fieldA or both in fieldb. 

 Define a search function that creates the form and a function that 
 does the search 

 def search_form(self,url): 
 form = FORM('', 
   
 INPUT(_name='search_text',_value=request.get_vars.search_text, 
_style='width:200px;', 
_id='searchText'), 
  INPUT(_type='submit',_value=T('Search')), 
  INPUT(_type='submit',_value=T('Clear'), 
  _onclick=jQuery('#search_text').val('');), 
  _method=GET,_action=url) 

 return form 

 def search_query(tableid,search_text,fields): 
 words= search_text.split(' ') if search_text else [] 
 query=tableid0#empty query 
 for field in fields: 
 new_query=tableid0 
 for word in words: 
 new_query=new_queryfield.contains(word) 
 query=query|new_query 
 return query 

 Then in the function that has the sqlform.grid call, before the call 
 add 

 search_text=request.get_vars.search_text 
 query=search_query(db.tablea.id,search_text, 
 [db.tablea.fielda,db.tablea.fieldb]) 
 ... 
 # the query could now be combined with other queries. 

 table=SQLFORM.grid(query, search_widget=search_form) 

 return dict(table=table) 










-- 





Re: [web2py] Re: sqlform.grid search widget

2012-07-19 Thread Richard Vézina
I think it will solve one of the issue I had with using sqlform.grid in
place of sqltable + Datatables. Since Datatables has a pretty simple
search/filter and my users knows how to use it than I would not remove this
kind of easy search/filter functionality and leave them with only a harder
more complex solution, so I stick with sqltable + Datatables even if
sqlform.grid is much more interesting...

Thank Peter.

Richard

On Thu, Jul 19, 2012 at 11:00 AM, peter peterchutchin...@gmail.com wrote:

 Thanks for this I had not noticed that clear did not work, I guess I never
 use it.

 The problem is a type in the search_form function

 The fifth line should read

 id = 'search_text'),

 not id='searchText'),


 Does anyone know if I can edit the first message in this topic so as to
 correct it?

 Peter



 On Wednesday, 18 July 2012 15:30:59 UTC+1, Elcimar wrote:


 Works like a charm, but the Clear button is working exactly like the
 Search one, without clearing 'search_text' before submit
 Is there another method to do that?

 Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff Kachinske
 escreveu:

 Good one.

 You earned a browser bookmark.

 Thanks.

 On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote:

 As I have commented before, sqlform.grid has a particular way of
 searching. Its combination of search and 'queries' is very powerful.
 However the search does not really work in the way a casual web user
 might expect. If entered - Bob Dylan - in the search box and clicked
 search, then one get 'invalid query'. I eventually worked out how to
 change the search widget, so as I believe this is currently
 undocumented I thought I would share it. The semantics I have chosen
 for search are that it will return records where any of the specified
 fields (fielda and fieldb in the example) contain all of the words in
 the search field. i.e if the search term is -Bob Dylan- it will return
 records that have both Bob and Dylan in the fieldA or both in fieldb.

 Define a search function that creates the form and a function that
 does the search

 def search_form(self,url):
 form = FORM('',

 INPUT(_name='search_text',_**value=request.get_vars.search_**text,
_style='width:200px;',
_id='searchText'),
  INPUT(_type='submit',_value=**T('Search')),
  INPUT(_type='submit',_value=**T('Clear'),
  _onclick=jQuery('#search_**text').val('');),
  _method=GET,_action=url)

 return form

 def search_query(tableid,search_**text,fields):
 words= search_text.split(' ') if search_text else []
 query=tableid0#empty query
 for field in fields:
 new_query=tableid0
 for word in words:
 new_query=new_queryfield.**contains(word)
 query=query|new_query
 return query

 Then in the function that has the sqlform.grid call, before the call
 add

 search_text=request.get_vars.**search_text
 query=search_query(db.tablea.**id http://db.tablea.id,search_text,

 [db.tablea.fielda,db.tablea.**fieldb])
 ...
 # the query could now be combined with other queries.

 table=SQLFORM.grid(query, search_widget=search_form.**...)

 return dict(table=table)








  --





-- 





[web2py] Re: sqlform.grid search widget

2012-07-18 Thread Elcimar

Works like a charm, but the Clear button is working exactly like the 
Search one, without clearing 'search_text' before submit
Is there another method to do that?

Em segunda-feira, 16 de abril de 2012 23h32min49s UTC-3, Cliff Kachinske 
escreveu:

 Good one.

 You earned a browser bookmark.

 Thanks.

 On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote:

 As I have commented before, sqlform.grid has a particular way of 
 searching. Its combination of search and 'queries' is very powerful. 
 However the search does not really work in the way a casual web user 
 might expect. If entered - Bob Dylan - in the search box and clicked 
 search, then one get 'invalid query'. I eventually worked out how to 
 change the search widget, so as I believe this is currently 
 undocumented I thought I would share it. The semantics I have chosen 
 for search are that it will return records where any of the specified 
 fields (fielda and fieldb in the example) contain all of the words in 
 the search field. i.e if the search term is -Bob Dylan- it will return 
 records that have both Bob and Dylan in the fieldA or both in fieldb. 

 Define a search function that creates the form and a function that 
 does the search 

 def search_form(self,url): 
 form = FORM('', 
   
 INPUT(_name='search_text',_value=request.get_vars.search_text, 
_style='width:200px;', 
_id='searchText'), 
  INPUT(_type='submit',_value=T('Search')), 
  INPUT(_type='submit',_value=T('Clear'), 
  _onclick=jQuery('#search_text').val('');), 
  _method=GET,_action=url) 

 return form 

 def search_query(tableid,search_text,fields): 
 words= search_text.split(' ') if search_text else [] 
 query=tableid0#empty query 
 for field in fields: 
 new_query=tableid0 
 for word in words: 
 new_query=new_queryfield.contains(word) 
 query=query|new_query 
 return query 

 Then in the function that has the sqlform.grid call, before the call 
 add 

 search_text=request.get_vars.search_text 
 query=search_query(db.tablea.id,search_text, 
 [db.tablea.fielda,db.tablea.fieldb]) 
 ... 
 # the query could now be combined with other queries. 

 table=SQLFORM.grid(query, search_widget=search_form) 

 return dict(table=table) 










-- 





[web2py] Re: sqlform.grid search widget

2012-04-16 Thread villas
Hi Peter,  
Just to say thank you so much for your posting this, and with this help I 
did get it working OK.  

@Book Editor.  In the absence of other documentation,  perhaps this example 
ought to be mentioned in the book?
Thanks, David


On Wednesday, 7 March 2012 09:44:00 UTC, peter wrote:

 As I have commented before, sqlform.grid has a particular way of 
 searching. Its combination of search and 'queries' is very powerful. 
 However the search does not really work in the way a casual web user 
 might expect. If entered - Bob Dylan - in the search box and clicked 
 search, then one get 'invalid query'. I eventually worked out how to 
 change the search widget, so as I believe this is currently 
 undocumented I thought I would share it. The semantics I have chosen 
 for search are that it will return records where any of the specified 
 fields (fielda and fieldb in the example) contain all of the words in 
 the search field. i.e if the search term is -Bob Dylan- it will return 
 records that have both Bob and Dylan in the fieldA or both in fieldb. 

 Define a search function that creates the form and a function that 
 does the search 

 def search_form(self,url): 
 form = FORM('', 
   
 INPUT(_name='search_text',_value=request.get_vars.search_text, 
_style='width:200px;', 
_id='searchText'), 
  INPUT(_type='submit',_value=T('Search')), 
  INPUT(_type='submit',_value=T('Clear'), 
  _onclick=jQuery('#search_text').val('');), 
  _method=GET,_action=url) 

 return form 

 def search_query(tableid,search_text,fields): 
 words= search_text.split(' ') if search_text else [] 
 query=tableid0#empty query 
 for field in fields: 
 new_query=tableid0 
 for word in words: 
 new_query=new_queryfield.contains(word) 
 query=query|new_query 
 return query 

 Then in the function that has the sqlform.grid call, before the call 
 add 

 search_text=request.get_vars.search_text 
 query=search_query(db.tablea.id,search_text, 
 [db.tablea.fielda,db.tablea.fieldb]) 
 ... 
 # the query could now be combined with other queries. 

 table=SQLFORM.grid(query, search_widget=search_form) 

 return dict(table=table) 










[web2py] Re: sqlform.grid search widget

2012-04-16 Thread Cliff
Good one.

You earned a browser bookmark.

Thanks.

On Wednesday, March 7, 2012 4:44:00 AM UTC-5, peter wrote:

 As I have commented before, sqlform.grid has a particular way of 
 searching. Its combination of search and 'queries' is very powerful. 
 However the search does not really work in the way a casual web user 
 might expect. If entered - Bob Dylan - in the search box and clicked 
 search, then one get 'invalid query'. I eventually worked out how to 
 change the search widget, so as I believe this is currently 
 undocumented I thought I would share it. The semantics I have chosen 
 for search are that it will return records where any of the specified 
 fields (fielda and fieldb in the example) contain all of the words in 
 the search field. i.e if the search term is -Bob Dylan- it will return 
 records that have both Bob and Dylan in the fieldA or both in fieldb. 

 Define a search function that creates the form and a function that 
 does the search 

 def search_form(self,url): 
 form = FORM('', 
   
 INPUT(_name='search_text',_value=request.get_vars.search_text, 
_style='width:200px;', 
_id='searchText'), 
  INPUT(_type='submit',_value=T('Search')), 
  INPUT(_type='submit',_value=T('Clear'), 
  _onclick=jQuery('#search_text').val('');), 
  _method=GET,_action=url) 

 return form 

 def search_query(tableid,search_text,fields): 
 words= search_text.split(' ') if search_text else [] 
 query=tableid0#empty query 
 for field in fields: 
 new_query=tableid0 
 for word in words: 
 new_query=new_queryfield.contains(word) 
 query=query|new_query 
 return query 

 Then in the function that has the sqlform.grid call, before the call 
 add 

 search_text=request.get_vars.search_text 
 query=search_query(db.tablea.id,search_text, 
 [db.tablea.fielda,db.tablea.fieldb]) 
 ... 
 # the query could now be combined with other queries. 

 table=SQLFORM.grid(query, search_widget=search_form) 

 return dict(table=table) 










[web2py] Re: Sqlform.grid search

2012-02-04 Thread peter
Yes thanks for this, it is powerful if you know how, but I am building
a website for other users. suppose a user types in the search box

cormac maccarthy

it would be nice if it did a search on all fields and found records
that contained both cormac and mccarthy. Maybe it would have to be
cormac maccarthy. I'm not sure but the simpler the better.

One can give the user only very simple instructions.

Peter
On Feb 4, 10:27 am, Michele Comitini michele.comit...@gmail.com
wrote:
 Suppose you have a table:

 db.define_table('book', Field('author', 'string'), Field('title',
 'string'), Filed('description', 'text'))

 you can search like this:

 author is cormac mccarthy and title contains horses

 mic

 2012/2/4 peter peterchutchin...@gmail.com:







  SQLFORM.grid's search box seems to only work with single word search
  terms. Has anyone looked into it working with multiple words, working
  as if they are 'and'ed together?


[web2py] Re: SQLFORM.grid: Search only startswith

2011-09-30 Thread Niphlod
http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#1527

maybe a patch with search_startswith parameter will improve current
search functionality, in case it is useful to someone else.

On Sep 29, 3:32 pm, Omi Chiba ochib...@gmail.com wrote:
 Does anybody know where is the code so I can try customize it ?

 On Sep 27, 6:20 pm, Omi Chiba ochib...@gmail.com wrote:







  For example, I have a field which has 'abcab' and 'bcabc' data.
  If I provide 'ab' in the search box, I want to just pull the first one
  ('abcab') and exclude second one ('bcabc'). Can we do this ?

  models/db.py
  -
  db.define_table('Product',
      Field('Part_Number'))

  controllers/default.py
  --
  def admin():
      products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
      return dict(products = products)


[web2py] Re: SQLFORM.grid: Search only startswith

2011-09-30 Thread Omi Chiba
Niphlod,

Thank you finding the source... yeah it's beyond my knowledge.

On Sep 30, 1:55 pm, Niphlod niph...@gmail.com wrote:
 http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#1527

 maybe a patch with search_startswith parameter will improve current
 search functionality, in case it is useful to someone else.

 On Sep 29, 3:32 pm, Omi Chiba ochib...@gmail.com wrote:







  Does anybody know where is the code so I can try customize it ?

  On Sep 27, 6:20 pm, Omi Chiba ochib...@gmail.com wrote:

   For example, I have a field which has 'abcab' and 'bcabc' data.
   If I provide 'ab' in the search box, I want to just pull the first one
   ('abcab') and exclude second one ('bcabc'). Can we do this ?

   models/db.py
   -
   db.define_table('Product',
       Field('Part_Number'))

   controllers/default.py
   --
   def admin():
       products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
       return dict(products = products)


[web2py] Re: SQLFORM.grid: Search only startswith

2011-09-30 Thread Massimo Di Pierro
type in the search field part_number starts with ab

On Sep 27, 6:20 pm, Omi Chiba ochib...@gmail.com wrote:
 For example, I have a field which has 'abcab' and 'bcabc' data.
 If I provide 'ab' in the search box, I want to just pull the first one
 ('abcab') and exclude second one ('bcabc'). Can we do this ?

 models/db.py
 -
 db.define_table('Product',
     Field('Part_Number'))

 controllers/default.py
 --
 def admin():
     products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
     return dict(products = products)


[web2py] Re: SQLFORM.grid: Search only startswith

2011-09-30 Thread Omi Chiba
Massimo,

I was like what are you talking about ? , then I noticed you actually
asking to input whole thing between  and ...

Yeah, it works !! but I cannot ask my users to do.

Like Niphlod said, option flag to switch the search method will be
great.

On Sep 30, 5:29 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 type in the search field part_number starts with ab

 On Sep 27, 6:20 pm, Omi Chiba ochib...@gmail.com wrote:







  For example, I have a field which has 'abcab' and 'bcabc' data.
  If I provide 'ab' in the search box, I want to just pull the first one
  ('abcab') and exclude second one ('bcabc'). Can we do this ?

  models/db.py
  -
  db.define_table('Product',
      Field('Part_Number'))

  controllers/default.py
  --
  def admin():
      products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
      return dict(products = products)


[web2py] Re: SQLFORM.grid: Search only startswith

2011-09-30 Thread Omi Chiba
And, actually it gives me error ticket if try model_id starts with 7
this for another field which is int not string.

Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 194, in restricted
exec ccode in environment
  File C:/web2py/applications/pricelist/controllers/default.py, line
104, in module
  File C:\web2py\gluon\globals.py, line 149, in lambda
self._caller = lambda f: f()
  File C:\web2py\gluon\tools.py, line 2456, in f
return action(*a, **b)
  File C:/web2py/applications/pricelist/controllers/default.py, line
39, in admin
products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
  File C:\web2py\gluon\sqlhtml.py, line 1535, in grid
subquery = smart_query(fields,key)
  File C:\web2py\gluon\dal.py, line 4005, in smart_query
elif op == 'startswith': new_query = field.startswith(value)
  File C:\web2py\gluon\dal.py, line 5255, in startswith
raise SyntaxError, startswith used with incompatible field type
SyntaxError: startswith used with incompatible field type



On Sep 30, 5:39 pm, Omi Chiba ochib...@gmail.com wrote:
 Massimo,

 I was like what are you talking about ? , then I noticed you actually
 asking to input whole thing between  and ...

 Yeah, it works !! but I cannot ask my users to do.

 Like Niphlod said, option flag to switch the search method will be
 great.

 On Sep 30, 5:29 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  type in the search field part_number starts with ab

  On Sep 27, 6:20 pm, Omi Chiba ochib...@gmail.com wrote:

   For example, I have a field which has 'abcab' and 'bcabc' data.
   If I provide 'ab' in the search box, I want to just pull the first one
   ('abcab') and exclude second one ('bcabc'). Can we do this ?

   models/db.py
   -
   db.define_table('Product',
       Field('Part_Number'))

   controllers/default.py
   --
   def admin():
       products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
       return dict(products = products)


[web2py] Re: SQLFORM.grid: Search only startswith

2011-09-29 Thread Omi Chiba
Does anybody know where is the code so I can try customize it ?

On Sep 27, 6:20 pm, Omi Chiba ochib...@gmail.com wrote:
 For example, I have a field which has 'abcab' and 'bcabc' data.
 If I provide 'ab' in the search box, I want to just pull the first one
 ('abcab') and exclude second one ('bcabc'). Can we do this ?

 models/db.py
 -
 db.define_table('Product',
     Field('Part_Number'))

 controllers/default.py
 --
 def admin():
     products = SQLFORM.grid(db.Product,deletable=False, paginate=10)
     return dict(products = products)