I like the way the search field shows up using smartgrid in web2py. But I dont want the table to b listed below because I want to customize the table display. Does anyone one if there way to display just the search box using smartgrid without displaying the table underneath.I know there is a way to create a search box using "like". But really like the search box from form factory
def test():
grid = SQLFORM.smartgrid(db.mytable)
return locals(){{extend 'layout.html'}}
{{=grid.element('.web2py_console form')}}
<ul>
{{for row in grid.rows:}}
<li>{{=row.title}}</li>
{{pass}}
</ul>
Thank u for responding. U misunderstood. I m trying to have a search bar on the top of the page without having the table populated below. The idea was to link my tables to the search n when some one puts a query it redirect s them to the table based on the query. Lets say I want a complete blank index.html with nothing but a white search box. Like what u see using the grid. But no table underneath to display. Then if someone search a query, it redirect them to a page with the results. Most pages I see shows up that way. The code u send me, I did that. But its same as showing smartgrid on the front page. Thats not what I was after.
--
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/xTCJzJrRuoo/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.
Can u send me a.link or point me to the chapter in the book? U can add. These mins to 37 that u mentioned. Its cool.
Well you can use LOAD to put the form there and then have the controller redirect if it has results.But really it's much simpler to just make your own search.
--
I mean python, web2py context. Without using jscript. Anyone have an example of creating a simple search box that are linked to ur datanase table?
--
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
from pydal.helpers.methods import smart_query
list_of_searchable_fields = [db.table.field1, db.table.field2, ...]
query = smart_query(list_of_searchable_fields, search_text)
rows = db(query).select()
I had to download paydal. It seems working. Except I need to difine search_text. N since thats an input, I believe i need to do form=SQLFORM.factory (Field ('search_text', label='peak inside', requires=IS_NOT_EMPTY ())) n then if form.process.accepted (): search_text = form.vars.search_name redirect(URL ('search results')). Right?
--
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/xTCJzJrRuoo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
Massimo, whats the right syntax to pass the variable to smart_query? U mentioned list. But [db.table.field] gives u the dal object n the code given me a error on line 110 in methods.py . U have isinstance (fields, (list, tuple))). So I believe smart_query takes in list or tuple. But how do I create a list or tuple from dal? I asked cuz it gives me a run time error. If I do db ().select (db.table.field) that makes a set. What will make a list/tuple so isinstance will b satisfied? Whats the right way to pass that variable into the routine. It cant b [db.table.field].
--
That code got bug in it. It cant b right.
--
Another way to do it is crud .search (db.table, query....)
--