[web2py] Grid: case insensitive sort

2022-11-03 Thread Vincent Borghi
Hello,

I have a simple SQLFORM.grid that shows the rows of my simple SQLite 
database.
In the grid, when I click on, say, the "vendorname" column header, this 
performs a kind of alphabetical sort, but the sort is case sensitive, so 
for example "AXE" comes before "Abc". How can I make the grid achieve a 
case insensitive sort?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6e4fd29b-78b5-4481-97e0-9b37545c462cn%40googlegroups.com.


[web2py] Web2py grid with no formname or formkey

2021-11-05 Thread Shaun Smith
Hi guys

Is it possible to create a grid without a formname and key? I am 
experimenting with service workers and offline mode and there are some 
intricacies regarding service workers and POST requests I am unfamiliar 
with and want to get a better understanding of. 

My current understanding is then that the server won't check the formkey 
and form data against the session and submit the form; in short for now I 
want to relax the restriction on double submission of forms to take 
advantage of SQLFORM.Grid's features.

Thanks and Kind Regards
Shaun

-- 
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/7641b3b1-76bd-4c85-9a25-3cbea4631571n%40googlegroups.com.


Re: [web2py] Re: Freshly cloned web2py, grid example says "not authorized"

2020-09-22 Thread AGRogers
Yes, I got bitten by this too. My opinion is that this decorator (and
others like it) should start commented out. These little obstacles can make
those first weeks unnecessarily harder.

On Wed, 23 Sep 2020, 1:18 pm BigBaaadBob,  wrote:

> Yes, thanks. I’m just surprised this doesn’t work In the Welcome
> application out of the box. I’m not writing a new application; I’m just
> clicking on the buttons provided in unchanged freshly cloned code.
>
> On Tuesday, September 22, 2020 at 11:04:00 AM UTC-7 Константин Комков
> wrote:
>
>> Hello! You need to comment decorator #@auth.requires_membership('admin')
>> or add your user in 'admin' group see chapter 9 Access Control in The book.
>> Also set table name, forexample:
>> tablename = 'auth_user'
>>
>>
>>
>> --
> 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/e9a55652-c0f7-40f9-8e60-6d8c6fed033dn%40googlegroups.com
> 
> .
>

-- 
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/CACWMBMPacmUXQiqbuou%2BJrWx3_eBn2CApHD3M_Aq9xh3hY8QhA%40mail.gmail.com.


[web2py] Re: Freshly cloned web2py, grid example says "not authorized"

2020-09-22 Thread BigBaaadBob
Yes, thanks. I’m just surprised this doesn’t work In the Welcome 
application out of the box. I’m not writing a new application; I’m just 
clicking on the buttons provided in unchanged freshly cloned code.

On Tuesday, September 22, 2020 at 11:04:00 AM UTC-7 Константин Комков wrote:

> Hello! You need to comment decorator #@auth.requires_membership('admin') 
> or add your user in 'admin' group see chapter 9 Access Control in The book.
> Also set table name, forexample:
> tablename = 'auth_user'
>
>
>
>

-- 
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/e9a55652-c0f7-40f9-8e60-6d8c6fed033dn%40googlegroups.com.


[web2py] Re: Freshly cloned web2py, grid example says "not authorized"

2020-09-22 Thread Константин Комков
Hello! You need to comment decorator #@auth.requires_membership('admin') or 
add your user in 'admin' group see chapter 9 Access Control in The book.
Also set table name, forexample:
tablename = 'auth_user'

-- 
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/cbf97c74-9a33-4f29-9d04-b0c744dfebdeo%40googlegroups.com.


[web2py] Freshly cloned web2py, grid example says "not authorized"

2020-09-22 Thread BigBaaadBob
I just now cloned (recursive) the web2py distro, started it, and clicked on 
the "grid example" button in the welcome application. I then registered 
when asked to authenticate. I got redirected back to the welcome app index 
page. I then click on the "grid example" button again and I get "Not 
authorized, insufficient privileges".

Should this work out-of-the-box?

-- 
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/03eb5752-0066-48ae-8cfb-7cb8775c3056n%40googlegroups.com.


[web2py] grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Vlad
I've got a page with a grid on it. 
grid reloads the page on create and other actions. 
the page to begin with has arguments, for example, page/1/2/3. 
I want the grid to keep these 1/2/3 in place when reloading the page on 
those actions, for example, on new record it should use page/1/2/3/new 
instead of page/new. 
How do I achieve it? There must be a parameter that enables grid to keep 
the args, but I can't find it - 

-- 
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/e6726180-a420-4aa0-a2e8-2ce01ddbf91b%40googlegroups.com.


[web2py] Grid sorting sorts by id (in case of a FK) instead of shown value (eg. name). Is this normal?

2019-04-29 Thread jcrmatos
Grid sorting sorts by id (in case of a FK) instead of shown value (eg. 
name). Is this normal?

The only way I found to correct this behavior was to change the grid's 
table to a query, where in this query I include all the foreign fields (eg. 
name) directly and remove al the foreign keys.
Is this the correct/only way to solve it?

-- 
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] Grid search collects all records from all fields on each request. Isn't this bad for performance?

2019-04-29 Thread jcrmatos
Grid search collects all records from all fields on each request. Isn't 
this bad for performance?

Isn't it possible to change this behavior to only load the records when the 
user selects a specific field to do the search?

-- 
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] Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-29 Thread jcrmatos


Grid search and clear buttons don't restore request.args. Where can I 
correct that?


If using master-child pages, the master grid search works fine (because 
there are no request.args), but the child grid (which has request.args, 
from the master record) doesn't because the search and clear buttons don't 
restore the request.args.


web2py 2.18.5
Python 3.7.1 x86
Firefox 66.0.3 x64
Windows 7 Pro x64 SP1+all upds

-- 
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] Grid sorting questions (referenced fields and case sensitive)

2019-03-28 Thread João Matos
Hello,

I have these 2 tables opt and opt_cat, where opt depends on opt_cat for the 
category name and other settings.

db.define_table('opt',
Field('name', 'string', label=T('Name'), length=NAME_LEN, 
notnull=True,
  required=True, unique=True),
Field('opt_cat_id', 'reference opt_cat', label=T('Category'
),
  notnull=True, required=True),
auth.signature,
format='%(name)s',
)

db.define_table('opt_cat',
Field('name', 'string', label=T('Name in Portuguese'), 
length=NAME_LEN,
  notnull=True, required=True, unique=True),
Field('name_en', 'string', label=T('Name in English'),
  length=NAME_LEN, notnull=True, required=True, unique=
True),
Field('mandatory', 'boolean', default=False,
  label=T('Mandatory'), notnull=True, required=True),
Field('one_opt_only', 'boolean', default=False,
  label=T('One option only'), notnull=True, required=
True),
auth.signature,
format='%(name)s',
)

I was testing grid sort and found that a grid like this

table = db.opt

grid = SQLFORM.grid(
table,
csv=False,
details=False,
maxtextlength=GRID_COL_LEN_FOR_TEXT,
ondelete=on_delete,  # Grid only.
onvalidation=on_validation,  # Form only.
orderby=db.opt.name,
paginate=session.auth.user.pagination,
# represent_none='',  # Grid and view form only.
)

will sort by opt_cat_id and not by the opt_cat.name that is shown.
The only solution I've found is to make a join between the 2 columns and 
show the client.name directly.

query = db.opt.opt_cat_id == db.opt_cat.id

grid = SQLFORM.grid(
query,
csv=False,
details=False,
field_id=db.opt.id,
fields=[
db.opt.name,
db.opt_cat.name,
db.opt_cat.name_en,
],
headers={'opt_cat.name': T('Category'), 'opt_cat.name_en': T(
'Category')},
maxtextlength=GRID_COL_LEN_FOR_TEXT,
ondelete=on_delete,  # Grid only.
onvalidation=on_validation,  # Form only.
orderby=db.opt.name,
paginate=session.auth.user.pagination,
# represent_none='',  # Grid and view form only.
)


Is there a better solution?

Another question is that I see that the sorting is ASCII based (small case 
after upper case).

Is there any way to make it sort without being case sensitive?


Thanks,

JM

-- 
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] Grid sorting bug when default orderby column type is date

2019-03-28 Thread João Matos
Hello,

I have this action

@auth.requires(auth.has_membership(CHECKER_ROLE) or auth.has_membership(
SUPERVISOR_ROLE))
def list_tags_to_issue():
"""List tags to issue.

:return: Dict with grid.
"""

   query = ((db.wo.is_active == True)
& (db.wo.tags_issued == False)
& (db.wo.pies_verified == False)
& (db.wo.equipment_id == db.equipment.id))

grid = SQLFORM.grid(
query,
create=False,
csv=False,
deletable=False,
details=False,
editable=False,
fields=[db.wo.est_finish,
db.equipment.name,
db.wo.sn,
db.wo.opts,
db.wo.finished,  # Necessary dummy entry.
db.wo.canceled_on,  # Necessary dummy entry.
db.wo.canceled_by,  # Necessary dummy entry.
db.wo.cancel_approved_by,  # Necessary dummy entry.
],
orderby=db.wo.est_finish,
)

return dict(grid=grid)

With this view

{{extend 'layout.html'}}

{{=T('List tags to issue')}}

{{=grid}}

{{if DEV:
=response.toolbar()
pass}}

If I try to change the sorting in the default orderby column (est_finish) 
it doesn't occur.
The URL is changed from  ...orderby=do.wo.est_finish to 
...orderby=~db.wo.est_finish, but the grid doesn't change.
When I see the db stats, the SQL command also didn't change.
The SQL command is always

SELECT "wo"."est_finish", "equipment"."name", "wo"."sn", "wo"."opts", 
"wo"."finished", "wo"."canceled_on", "wo"."canceled_by", 
"wo"."cancel_approved_by", "wo"."id" 
FROM "wo", "equipment" 
WHERE "wo"."is_active" = 'T') AND ("wo"."tags_issued" = 'F')) AND 
("wo"."pies_verified" = 'F')) AND ("wo"."equipment_id" = "equipment"."id")) 
ORDER BY "wo"."est_finish", "wo"."id" LIMIT 20 OFFSET 0;

no matter the URL changing from ...orderby=do.wo.est_finish to 
...orderby=~db.wo.est_finish.

This is one of 3 different views (all have in common a orderby with a date 
column) that show this problem. All others work correctly.

If I remove the orderby parameter from the grid or change it to a non-date one, 
everything works, including the sorting of the date column.

Any ideas?

Thanks,

JM


-- 
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] grid reloading the page and outdated flash msgs? (strange behavior...)

2018-12-27 Thread Vlad
Here is a test function in my controller: 

def test():
id = 0
try:
id = request.args(0, cast=int)
session.flash = "Here is the id: " + str(id)
except:
session.flash = "ID is not valid!"
pass
if id==0:
redirect(URL('home'))
query = db.test_table.id == id
grid = SQLFORM.grid(query, db.test_table, user_signature=False)
return locals()

Here are issues I've encountered with this (not sure if they are 
independent or related): 

1) the flash msg displays the previously passed parameters, not the latest 
one. This is weird! For example, app/home/test/1 called the first time does 
NOT display any flash msg at all.  When I call it the 2nd time - 
app/home/test/2 - the flash message displays "1", i.e. previously called 
number. At the same time, the page displays correctly - the page knows that 
the correct number is 2 indeed now. 

2) The grid behaves very strangely. Here is how: when I delete a record, 
the page silently reloads (I know this because of the flash message - which 
displays the previous id, not the current one), and in case this is my 
first call to this page, it comes out that ID is not valid and id equals 0 
EVEN THOUGH I passed the parameter through vars (app/home/test/1) it breaks 
the delete - delete never commits to the database. It does delete the row 
from the grid thought, so visually the row is gone, but the database is not 
altered. At the same time, if I remove that redirect('home') - the delete 
completes and commits to the database just fine (i.e. as long as redirect 
is not there - even though this strange reloading of the page is going on - 
it doesn't bother me - the messed up parameter only causes redirect which 
somehow breaks the delete). 

Namely, the following code (same but without redirect): 

def test():
id = 0
try:
id = request.args(0, cast=int)
session.flash = "Here is the id: " + str(id)
except:
session.flash = "ID is not valid!"
pass
query = db.test_table.id == id
grid = SQLFORM.grid(query, db.test_table, user_signature=False)
return locals()

still doesn't display flash msgs correctly, BUT it does not break grid's 
functionality - delete completes (can't fathom how this could be, as if 
request.var is incorrect - then the page should display incorrectly, but if 
request.var is somehow correct then redirect should never happen to begin 
with, how can it influence anything? And if redirect is actually called 
(and it is) on grid's delete operation, it means that the id is now 
incorrect, why doesn't it break the view of the page?? I am totally 
confused...

I hope this doesn't sound messy :) I've been going crazy for a while until 
I've isolated what I've just described... 

And, by the way, the app logic I am trying to achieve is simple: I pass the 
param through request.vars but then first check if the current user is 
authorized, and if not - I redirect. I need some custom authorization logic 
here, so usual auth decorates don't help in my situation.

3) this is more of a side issues, but I'll mention it, as I am on the grid: 
in some situations grids work just fine without user_signature=False , but 
sometimes they refuse and display error msgs like not authorized etc. I 
can't detect the difference when it's needed. This is not a big deal, I can 
just place user_signature=False whenever, but it does bother me, since I 
don't understand what exactly is causing this difference that breaks the 
functionality in some situations. 

Any suggestions are greatly appreciated 
 

-- 
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] grid: top + button: how to adapt dynamically & translate the title 'add record to database' ?

2018-02-12 Thread Serge Bourgeois

Hello,
The following codes changes dynamically the title of the button on the top 
left of the form in English.
But when I switch to another language (exemple FR), I get the French 
translation of 'Add record to database', and not the translation of what I 
have placed in the title of this button.

Example:
   
form = SQLFOR.smartgrid(db[my_table]..., showbuttontext=False, ...)

if not 'view' in request.args and not 'edit' in request.args and not 
'new' in request.args:
   addbutton = form.element(_title='Add record to database')
   my_table = 'my application table'
   addbutton['_title'] = '%s %s' % ( T('Add'), db[my_table]._singular 
return dict(form = form)
=> in English, the title of the + button is 'Add' + the value of 
db[my_table]._singular : This is perfect!
=> in French, I always get 'Ajout d'un enregistrement', which is the 
translation of 'Add record to database'. : this is not what I want...

I have tried the following, but, same result:
   if not 'view' in request.args and not 'edit' in request.args and not 
'new' in request.args:
   my_title = T('Add record to database)'
   addbutton = form.element(_title= my_title)
   my_table = 'my application table'
   addbutton['_title'] = '%s %s' % ( T('Add'), db[my_table]._singular 
return dict(form = form)

Thanks for any advise for translating the title of the top left '+' button 
when I change if in the controller.

-- 
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] grid column names do not print nicely

2017-12-20 Thread icodk
When in grid or smartgrid trying to print the page with browser's own print 
function, columns name comes out as URLS of the page instead of the text of 
the name of the column name. 
Could be nice to be able to print with browser own print function.

-- 
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] grid IS_IMAGE validator behavior

2017-12-06 Thread Carlos Cesar Caballero Díaz
Hi, I have being using web2py for some time, but I don't use files too 
often, now I am using the IS_IMAGE, but using the grid on edit it's 
throwing a validation error if the user don't set a new image.


It's a bug or is the default behavior?

--
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] Grid edit behavior when no changes are made

2017-08-02 Thread Seth J
Quick question, guys.  I've noticed that when record is edited in a grid 
and no changes are made to it when hitting 'Submit' no entry is made into a 
corresponding archive table.  However, fields "modified on" and "modified 
by" are adjusted according to a user who submitted a change.  Is there way 
to either not change the latter fields or put an entry in an archive table 
reflecting previous state?  
It becomes a little bit misleading and hard to proof that people have not 
made any changes to the record when their name appears as an editor of the 
field.  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/d/optout.


[web2py] grid show or hidden table coloumn

2017-08-01 Thread 黄祥
is it possible to show or hidden table coloumn in grid base on user choosen?

thanks and best regards,
stifan

-- 
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] grid for data entry

2017-07-22 Thread T.R.Rajkumar
I want data to be captured for tdr_bid_unrev_detls.rate. I have the query 
below.

select d.jcod,d.qty,u.rate,u.amt
from tdr_tender_master t join  amc_master m on t.amc_id = m.id
 join amc_details d on m.id = d.amc_id
 left join tdr_bid_unrev_detls u on u.tdr_id = t.id and u.amc_id = m.id 
where m.id = 15

This returns the result 

jcod qty  rateamt

cs00110.00NULLNULL
cs01010.00NULLNULL
cstest10.00NULLNULL
cs00210.00NULLNULL
asd 2.00NULLNULL
cs004 5.00 NULLNULL
test1 10.00 NULLNULL

Now I would like to fill the rate in the above result in a grid generated 
by the above query.
I tried this in controller

tdrid = request.vars.tdrid

query = (db.tdr_tender_master.id==tdrid) & (db.tdr_tender_master.amc_id == 
db.amc_master.id) & (db.amc_master.id == db.amc_details.amc_id) & 
(db.tdr_bid_unrev_detls.tdr_id == db.tdr_tender_master.id) 
left=db.tdr_bid_unrev_detls.on(db.tdr_tender_master.id == 
db.tdr_bid_unrev_detls.tdr_id)

form = SQLFORM.grid(query,left=left)

but i dont get the required form. I want to populate the 
tdr_bid_unrev_detls table. I am not able to do it myself reading the book. 
So pl. help. Thanks and regards.

 

-- 
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] Grid - limit searches to specified fields not whole tables

2017-07-07 Thread 'Matthew J Watts' via web2py-users


Hi all

 

I’m having problems trying to tailor the grid to my needs 

 

I've set up a grid to query my db and it retrieves the data successfully, 
great!

 

Example: def gridquery():

grid = SQLFORM.grid((db.MAIN.TaxonID == db.TAXON.TaxonID), field_id = 
db.MAIN.MainID, fields=[db.TAXON.TaxonName, db.TAXON.CommonName, 
db.TAXON.TaxonomicPhylum])

return locals() 

 

 

However, the search box contains all of the columns in all of the connected 
tables.  I want to limit the searches only to the fields i have specified 
e.g. 'fields=[db.TAXON.TaxonName, db.TAXON.CommonName, 
db.TAXON.TaxonomicPhylum])'. 

 

1.  I've tried to do a few things i.e.  setting the unwanted search 
fields to 'writable = False & readable = False' 

2.   also tried this method [setattr(f, 'readable', False) for f in 
mydb if f.name not in ('mydb.field')]

 

However, this limits the query results - i want to include all the tables 
fields in the query results, just not in the searches. 

 

Does anyone have any suggestions? As I understand I might need to build a 
custom widget, at my current level this seems rather complicated, are there 
any simpler work arounds. 

 

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/d/optout.


[web2py] grid add/edit form label

2017-06-01 Thread T.R.Rajkumar
The grid object accepts headers but is only for the grid. Now how to set 
the labels of the fields in grid add/edit forms. Thanks in advance.

-- 
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] grid edit

2017-05-23 Thread T.R.Rajkumar
I call this 127.0.0.1:8000/web_ocms/amc/newamcmaster/edit/amc_master/3 by 
clicking the edit button of the recor in the grid, and the edit form for 
the record is displayed. After editing when I submit error ticket is issued 
stating id column cannot be updated. Pl. help. Thanks for your time.
The ticket is

Error ticket for "web_ocms" Ticket ID 

127.0.0.1.2017-05-23.17-15-24.8a493eb8-5c35-4dd1-8ade-97ef1e190c7c
 ('42000', "[42000] [Microsoft][ODBC SQL 
Server Driver][SQL Server]Cannot update identity column 'id'. (8102) 
(SQLExecDirectW)") Version 
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 
Python Python 2.7.5: D:\Python\python.exe (prefix: D:\Python) Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.

Traceback (most recent call last):
  File "D:\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "D:/web2py/applications/web_ocms/controllers/amc.py" 
, line 
49, in 
  File "D:\web2py\gluon\globals.py", line 417, in 
self._caller = lambda f: f()
  File "D:/web2py/applications/web_ocms/models/db.py" 
, line 140, in 
wrapper
return callee()
  File "D:/web2py/applications/web_ocms/controllers/amc.py" 
, line 
42, in newamcmaster
grid = 
SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
  File "D:\web2py\gluon\sqlhtml.py", line 2352, in grid
next=referrer)
  File "D:\web2py\gluon\html.py", line 2298, in process
self.validate(**kwargs)
  File "D:\web2py\gluon\html.py", line 2236, in validate
if self.accepts(**kwargs):
  File "D:\web2py\gluon\sqlhtml.py", line 1744, in accepts
self.id_field_name]).update(**fields)
  File "D:\web2py\gluon\packages\dal\pydal\objects.py", line 2054, in update
ret = db._adapter.update("%s" % table._tablename, self.query, fields)
  File "D:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 1031, in 
update
raise e
ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL 
Server]Cannot update identity column 'id'. (8102) (SQLExecDirectW)")

Error snapshot [image: help] 

 

(('42000', "[42000] [Microsoft][ODBC SQL 
Server Driver][SQL Server]Cannot update identity column 'id'. (8102) 
(SQLExecDirectW)")) 

inspect attributes 
Frames 
   
   - 
   
   *File D:\web2py\gluon\restricted.py in restricted at line 227* code 
   arguments variables 
   - 
   
   *File D:\web2py\applications\web_ocms\controllers\amc.py in  at 
   line 49* code arguments variables 
   - 
   
   *File D:\web2py\gluon\globals.py in  at line 417* code arguments 
   variables 
   - 
   
   *File D:\web2py\applications\web_ocms\models\db.py in wrapper at line 
   140* code arguments variables 
   - 
   
   *File D:\web2py\applications\web_ocms\controllers\amc.py in newamcmaster 
   at line 42* code arguments variables 
   - 
   
   *File D:\web2py\gluon\sqlhtml.py in grid at line 2352* code arguments 
   variables 
   - 
   
   *File D:\web2py\gluon\html.py in process at line 2298* code arguments 
   variables 
   - 
   
   *File D:\web2py\gluon\html.py in validate at line 2236* code arguments 
   variables 
   - 
   
   *File D:\web2py\gluon\sqlhtml.py in accepts at line 1744* code arguments 
   variables 
   - 
   
   *File D:\web2py\gluon\packages\dal\pydal\objects.py in update at line 
   2054* code arguments variables 
   - 
   
   *File D:\web2py\gluon\packages\dal\pydal\adapters\base.py in update at 
   line 1031* code arguments variables 
   Function argument list 
   
   (self=, 
   tablename='amc_master', query=, 
   fields=[(, None), (, 'bid'), (, None), 
   (, None), (, None), 
   (, None), (, None), 
   (, None), (, None), 
   (, 3L), (, None), 
   (, None), (, None), 
   (, datetime.datetime(2017, 5, 23, 16, 59, 23)), 
   (, None), (, None), 
   (, None), (, None), 
   (, None), (, None), 
   ...])
   Code listing 
   
   1026.
   1027.
   1028.
   1029.
   1030.
   1031.
   
   1032.
   1033.
   1034.
   1035.
   
   except Exception:
   e = sys.exc_info()[1]
   table = self.db[tablename]
   if hasattr(table,'_on_update_error'):
   return table._on_update_error(table,query,fields,e)
   raise e
   
   try:
   return self.cursor.rowcount
   except:
   return None
   
   Variables 
   e
   
   
   ProgrammingError('42000', "[42000] [Microsoft][O...e identity column 
   'id'. (8102) (SQLExecDirectW)")
   
   
   
   
   

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- 

[web2py] grid oncreate

2017-05-22 Thread T.R.Rajkumar
I have this in model.
db.define_table('amc_master',
Field('amcno', 
type='string',length=10,required='True',notnull='True',requires=IS_LENGTH(10)),
Field('unitid',type='string',length=3,notnull='True'),
Field('amcdesc', 
type='string',length=512,required='True',notnull='True'),
Field('estval', type='decimal(18,2)'),
Field('supcflg', type='string', length=1),
Field('supcval',type='decimal(18,2)'),
Field('netestval',type='decimal(18,2)'),
Field('bidmethod',type='string',length=3),
Field('capbud',type='string',length=1),
Field('amcmod',type='string',length=3),
Field('lrrflg',type='string',length=1),
Field('insflg',type='string',length=1),
Field('stflg',type='string',length=1),
Field('phwflg',type='string',length=1),
Field('contyp',type='string',length=3),
Field('rfact',type='decimal(18,2)'),
Field('qfact',type='decimal(18,2)'),
Field('emdamt',type='decimal(18,2)'),
Field('doccharge',type='decimal(18,2)'),
Field('divn',type='string',length=3),
Field('subdivn',type='string',length=2),
Field('cflg',type='string',length=1),
Field('statflg',type='string',length=3),
Field('appauthority',type='string',length=16),
Field('accappddt',type='datetime'),
Field('iewappddt',type='datetime'),
Field('complndays',type='integer'),
Field('examcno',type='string',length=10),
Field('consoldamcstr',type='string',length=70),
Field('isconsold',type='string',length=1),
Field('estonprovn',type='decimal(18,2)'),
Field('totest',type='decimal(18,2)'),

Field('update_uid','string',length=6,required='True',notnull='True'),
Field('update_dt','datetime',required='True',notnull='True')
)

in controller i have this

def newamcmaster():
list_of_fields = 
[db.amc_master.amcdesc,db.amc_master.amcmod,db.amc_master.complndays]
[setattr(f, 'readable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays']]
[setattr(f, 'writable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays']]
grid = 
SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
return locals()

when I call http://127.0.0.1:8000/web_ocms/amc/newamcmaster the grid 
displays the three fields amcdesc, amcmod, complndays.

When addrecord is clicked it displays form with the above three fields 
correctly. 

Now the amcno,update_uid, update_dt fields are mandatory but has to be 
filled by the server. The user is not to input these fields.

How to insert a new record with user inputting the three fields and other 
required fields are filled in oncreate callback or some other methods. Pl. 
help. Regards.

-- 
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] grid ondelete redirection

2017-03-18 Thread Andrea Fae'
Why the redirection is not working?

def mostra_evento():
evento_id=request.args(0)
query = (db.evento.id == evento_id)

db.evento.inizio.writable=db.evento.fine.writable=db.evento.risorsa.writable=db.evento.docente.writable=db.evento.materia.writable=False
db.evento.colore.readable=db.evento.colore.writable=False

# recupero la sede dell'evento
sede_evento = db(db.risorsa.id == 
db.evento.risorsa).select().first().risorsa.sede

exportcls = dict(csv_with_hidden_cols=False, html=False, json=False, 
tsv_with_hidden_cols=False, tsv=False)
callback = lambda *args: redirect(URL('default', 'index'))
form = SQLFORM.grid(query, args=[evento_id], 
fields=[db.evento.titolo,db.evento.inizio,db.evento.fine,db.evento.risorsa,db.evento.docente,db.evento.studenti],create=False,
 
details=True, editable=True, deletable=True, maxtextlength=60, 
exportclasses = exportcls, ondelete=callback)
return dict(form=form)


...and moreover the record isn't deleted!
For the true I'd like to redirect not on index but in "sched" wirh 
args=sede_evento

How todo?
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/d/optout.


[web2py] grid export data with left join and groupby

2017-02-08 Thread 黄祥
hello, is it possible to have grid export data with left join and groupby 
output same like on the screen?
e.g.
def report_do():
table_header = db.do_header
table_detail_0 = db.do_product_detail
table_detail_1 = db.do_stock_detail

groupby = table_detail_1.stock
left = [table_detail_0.on(table_header.id == table_detail_0.do_no), 
table_detail_1.on(table_header.id == table_detail_1.do_no) ]
grid = SQLFORM.grid(table_header, left = left, groupby = groupby, csv = csv)
return locals()

output on screen let say it have 2 records, but the exported csv have 4 
records, because the detail table that related to table is have multiple 
product or stock. (no error occured but the result is not expected)

i've check on gluon/sqlhtml.py but don't know how to modified ExporterCSV, 
is there any hints for that?

thanks and best regards,
stifan

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

2017-01-24 Thread Javier Pepe
Hi

You can use selectable metod to pass selected row to a function to update
records.



El sáb., 21 ene. 2017 a las 12:05, Bishal Saha ()
escribió:

> Cant we use grid to update few rows ?
>
> --
> 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.
>

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

2017-01-21 Thread Bishal Saha
Cant we use grid to update few rows ?

-- 
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] Grid search disregards time zone

2017-01-12 Thread icodk
My server is in UTC, my client is in Europe (time zones) .When client 
searches on a date time field the datetime string is sent in local time. 
The grid is showing datetime in local time as it should,using the great 
timezone plugin
(didn't work also before Breksit:-)

-- 
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] Grid export csv

2016-07-29 Thread Ryan Hood
How do you get the csv export to work in web2py grid? 

NOTE: Working with web2py version 2.14.6 and 2.14.5

Thank you,

-- 
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] grid exportclasses not work in recent version

2016-06-16 Thread Anthony
Yes, an issue has already been filed. For now, you must use a dictionary with a 
key for each table.

-- 
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] grid exportclasses not work in recent version

2016-06-16 Thread 黄祥
just want to report grid exportclasses is not work in recent version :
e.g.
def index():
table = db.test
exportclasses = dict(csv_with_hidden_cols=False, xml=False, json=False, 
tsv_with_hidden_cols=False, tsv=False)
grid = SQLFORM.smartgrid(table, exportclasses = exportclasses)
return locals()

no error occured, but the result is not expected.
any idea what's going on with the problem?

thanks and best regards,
stifan

-- 
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] Grid remove class date/datetime

2016-05-12 Thread isi_jca
Hi!!!

Is possible to remove class date/datetime from form Grid?.

Thanks in advance

-- 
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] Grid custom DropBox

2016-02-20 Thread Charles tenorio
I have a SQLFORM.grid, where one of the columns and has a combo box,
I created so
lambda row: SELECT ('House', 'Off', 'Draw', name = 'spocoes'),
I would like to know how to catch. the combo of value and move to args.

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/d/optout.


[web2py] GRID export broken for CSV but not for JSON

2016-02-12 Thread olivier hubert

I implemented a clone of Notifier application from Massimo.
If I try to export data from the grid via the grid bottom button I receive 
an error if I use export to CSV, HTML & TSV but not with JSON or XML.

*default.py*
@auth.requires_login()
def tasks():
db.task.created_on.readable = True
db.task.created_by.readable = True
db.task.title.represent = lambda title, row:A(title, _href=URL(
'view_task', args=row.id))
query = (db.task.assigned_to==me)|(db.task.created_by==me)
grid = SQLFORM.grid(query,
orderby=~db.task.modified_on,
create=False,
details=False,
editable=False,
deletable=lambda row: (row.created_by==me),
fields=[
db.task.status,
db.task.title,
db.task.created_on,
db.task.deadline,
db.task.created_by,
db.task.assigned_to
])
return locals()

*Traceback*

 Traceback (most recent call last):
 File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 227, 
in restricted
 exec ccode in environment
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
, 
line 134, in 
 File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, in 

 self._caller = lambda f: f()
 File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, in 
f
 return action(*a, **b)
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
, 
line 31, in tasks
 db.task.assigned_to
 File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440, 
in grid
 raise HTTP(200, oExp.export(), **response.headers)
 File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468, 
in export
 self.rows.export_to_csv_file(s, represent=True)
 File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py", 
line 2412, in export_to_csv_file
 value = field.represent(value, record)
 File 
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
 
, 
line 17, in 
 db.task.title.represent = lambda title, row:A(title, _href=URL('view_task', 
args=row.id))
 File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py", 
line 90, in __getattr__
 raise AttributeError
AttributeError


The error come from the bellow code line from the file default.py
db.task.title.represent = lambda title, row:A(title, _href=URL('view_task', 
args=row.id))

If I remove the previous row the export function work for all format but I 
lose the cliquable link on the task title.

I checked with the Notifier application available on GitHub 
https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and I 
see the same problem.

If you can help me it's very appreciate.

Kind regards
Olivier



-- 
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] Grid without consulting database

2015-09-10 Thread Luis Valladares
Hello! I'm trying to use SQLFORM.grid (or something like this) to my 
website, but this page doesnt have a database because it consumes all the 
data form a service, so i ask the service for the list of records in a 
table and i recieve it in json format and transform to dictionary.

What i want to do is use this dictionary to create a grid (Like the 
SQLFORM.grid) but the grid doesnt work if i dont specify a query, there is 
a way to create a grid without query and instead with a dictionary?

Thanks for any help you can give!

-- 
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] Grid query

2015-09-01 Thread Johann Spies
On 31 August 2015 at 15:17, Manuele Pesenti 
wrote:

> Il 31/08/15 09:54, Manuele Pesenti ha scritto:
> > to brutally by-pass the exception you can try something like...
> >
> > papers = db.wos_papers_by_dt.count.sum()
> > setitem(papers, "tablename", "wos_papers_by_dt")
> I apologize... I mean setattr not setitem.
>

Thanks.  More and more I am using pure sql to get things done, create views
and materialized views and just use Web2py to "show" the results.  I find
myself spending too much time to figure out how to do some more complicated
queries in DAL.  It is just easier to do whatever I want in SQL.

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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] Grid query

2015-08-27 Thread Johann Spies
In SQL I can do

select doctype, sum(count) number
from wos.za_publications
where pubyear  1979
group by doctype;

In the web2py shell I can do:

db.define_table('wos_papers_by_dt',
Field('pubyear', 'integer'),
Field('doctype'),
Field('count', 'integer'),
migrate = False,
rname = 'wos.za_publications')

papers = db.wos_papers_by_dt.count.sum()
query = db.wos_papers_by_dt.pubyear  1979
l = db(query).select(db.wos_papers_by_dt.doctype,papers, groupby =
db.wos_papers_by_dt.doctype)


for i in
l:

print i['_extra']['SUM(wos.za_publications.count)'],
i['wos_papers_by_dt']['doctype']

which produces a similar result.

Why is it not working when, using the same model and logic I get an error
when I try to put the result in a grid?

za_arts = SQLFORM.grid(query,
   fields=[db.wos_papers_by_dt.doctype, papers],
   groupby = db.wos_papers_by_dt.doctype,
   headers = headers,
   create = False,
   editable = False,
   details = False,
   deletable = False,
   searchable = False
   )

raceback (most recent call last):
  File /home/js/web2py/gluon/restricted.py, line 227, in restricted
exec ccode in environment
  File /home/js/web2py/applications/wos_2015_3/controllers/wos_indicators.py
http://localhost:8000/admin/default/edit/wos_2015_3/controllers/wos_indicators.py,
line 169, in module
  File /home/js/web2py/gluon/globals.py, line 412, in lambda
self._caller = lambda f: f()
  File /home/js/web2py/applications/wos_2015_3/controllers/wos_indicators.py
http://localhost:8000/admin/default/edit/wos_2015_3/controllers/wos_indicators.py,
line 49, in za_arts_by_doctype
searchable = False
  File /home/js/web2py/gluon/sqlhtml.py, line 2183, in grid
columns = [f for f in fields if f.tablename in tablenames]
AttributeError: 'Expression' object has no attribute 'tablename'


Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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] grid: get rid of view buttons

2015-07-01 Thread jackson . read
I have a sqlform.grid, I would like to get rid of the view buttons at the 
end of each row. Unfortunately the grid has no attribute 'viewable' that 
you can set to False. Does anyone know how to do this??

-- 
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: web2py grid edit

2015-06-30 Thread Ben Lawrence
Also, if you look in your admin screen there are plug-ins available. One of 
them is plugin_SQLFORM_INLINE


On Tuesday, June 30, 2015 at 10:29:40 AM UTC-7, Alessio Varalta wrote:

 Hi, i have a problem. I have a grid form but i want that the user can 
 modify the field without the section edit..So i want load a grid where the 
 user can modify the field and after click on a save button a save all 
 parameters


-- 
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] web2py grid edit

2015-06-30 Thread Alessio Varalta
Hi, i have a problem. I have a grid form but i want that the user can 
modify the field without the section edit..So i want load a grid where the 
user can modify the field and after click on a save button a save all 
parameters

-- 
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: web2py grid edit

2015-06-30 Thread villas
Maybe Tim Richardson's ideas will help from web2pyslices 
...
http://www.web2pyslices.com/slice/show/1928/basic-inline-editing-in-sqlformgrid-no-plugin-no-javascript
http://www.web2pyslices.com/slice/show/1714/jqgrid-viewing-and-updating-data

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

2015-06-17 Thread jackson . read
Is there anyway to make a SQLform.grid scroll instead of using page numbers.

-- 
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] grid and field_id

2015-05-05 Thread Massimiliano
Hi,

in web2py 2.9.5 and older I was using database views to simplify my work
doing  something like that:

  db.define_table('mytable',Field('myfield))

having a view on my db with all mytable fields plus some others.

I define the view in web2py:

  db.define_table('myview',Field('myfield), Field('otherfield'))

So I was using the grid in this way:

  SQLFORM.grid(db.myview, field_id=db.mytable.id)

and worked like a charm showing the view in the grid and editing mytable in
add/edit/delete

Now doesn't work anymore cause this line of code:

  orderby = fix_orderby(orderby) in sqlhtml.py line 2561 (2.10.4)

but a simple:

  if not orderby:
 orderby = fix_orderby(orderby)

fix the problem.

I don't know if this way to proceed is/was supported or not but could save
a lot of work.

Can we restore the older behaviour?

What do you think?

Thank you
-- 
Massimiliano

-- 
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] grid and field_id

2015-05-05 Thread Richard Vézina
It surely not going to be fix in 2.9.5... Do you check in new version of
web2py if this issue is still relevant? If so consider open a ticket and
maybe make a PR so others can review it.

Richard

On Tue, May 5, 2015 at 9:09 AM, Massimiliano mbelle...@gmail.com wrote:

 Hi,

 in web2py 2.9.5 and older I was using database views to simplify my work
 doing  something like that:

   db.define_table('mytable',Field('myfield))

 having a view on my db with all mytable fields plus some others.

 I define the view in web2py:

   db.define_table('myview',Field('myfield), Field('otherfield'))

 So I was using the grid in this way:

   SQLFORM.grid(db.myview, field_id=db.mytable.id)

 and worked like a charm showing the view in the grid and editing mytable
 in add/edit/delete

 Now doesn't work anymore cause this line of code:

   orderby = fix_orderby(orderby) in sqlhtml.py line 2561 (2.10.4)

 but a simple:

   if not orderby:
  orderby = fix_orderby(orderby)

 fix the problem.

 I don't know if this way to proceed is/was supported or not but could save
 a lot of work.

 Can we restore the older behaviour?

 What do you think?

 Thank you
 --
 Massimiliano

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


-- 
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] grid that only show search field

2015-03-13 Thread 黄祥
hi,

is it possible to use grid that only show search field? the grid data table 
will show after user the search query is entered

thanks and best regards,
stifan

-- 
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] .grid() my own search widget possible? How?

2015-03-06 Thread Richard Vézina
You want the table to pop when there will be results selected?

If so, I guess you will need some JS. You will need to init the table with
a query that prevent any result to be selected (this query will require to
be hiden somehow JS this is the tricky part, you will need to clear behind
the scene this select NONE creteria when the user will have to input it own
query). Then you write a little js that check if there is rows or not in
the table and un hide the table when there is row(s)...

Richard



On Thu, Mar 5, 2015 at 7:20 PM, Ron Chatterjee achatterjee...@gmail.com
wrote:

 I just posted a question in the web2py group. Searching I came to this
 post. Since you guys worked on this. What if I do like the default search
 and want to stick with it and display the search box that comes out
 of SQLFORM.grid or smartgrid but I don't want to display the table
 underneath. Do you know a way to do that?



 On Thursday, June 5, 2014 at 10:19:16 AM UTC-4, Jim S wrote:

 Just dummy'd up this app quickly.

 Let me know if you have any issues.

 -Jim


 On Wednesday, June 4, 2014 10:24:34 PM UTC-5, JoeCodeswell wrote:

 Dear Richard and Jim,

 Would you both please post your sample code?

 I am trying to implement an autocomplete search widget on a
 db.contact.l_name field using SQLFORM.grid.

 Thanks in advance.

 Love and peace,

 Joe

 On Thursday, April 24, 2014 8:10:01 AM UTC-7, Richard wrote:

 I am reading the sqlhtml.py search_widget...

 So I would just pass my function (search widget) like that :

 SQLFORM.grid(...,
search_widget=my_search_widget_function)

 ?

 Thanks

 Richard


 On Thu, Apr 24, 2014 at 10:38 AM, Jim S j...@qlf.com wrote:

 Yes, you definitely can.

 I don't ever use the default search.

 In a nutshell, you have to create your own search form and then apply
 the results of that form to the query passed to the grid.  Let me know if
 you need an example and I'll see if I can put a quick one together for you
 today.

 -Jim


 On Thursday, April 24, 2014 9:18:39 AM UTC-5, Richard wrote:

 Hello,

 Is it possible to create my own search widget? How does I get the
 grid to use it?

 Thanks

 Richard

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


-- 
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] .grid() my own search widget possible? How?

2015-03-06 Thread Ron Chatterjee
Basically, quick and dirty way to display the search bar on the top of the 
site using smartgrid without showing the table. Then when someone put a 
query and hit, search, be able to redirect to another page. That way, the 
prototype will be complete without writing a customized search routine. 
Once it works, then I could go do all the hard work of writing up the 
search bar that search through my table based on user query. 

Do you know a way to make a search bar on the top of a page in web2py (like 
one we have on this page or yahoo.com or any other page. Except, I don't 
want the web search. Search based on whats in my table/database), and then 
when someone type something redirect that to a page where the table is 
displayed?

It should be a very common feature to have since every page I visit now a 
days seem to have a search bar with auto completion on upper right corner. 
It seems I am the only one who needs it. lol. I don't know why its such a 
big deal for web2py community. Why js? Why can't be done using a python 
script or web2py routine? Just curious. Since, my only purpose of using 
python and web2py framework that I don't know jscript that well.

Ron


On Friday, March 6, 2015 at 9:08:24 AM UTC-5, Richard wrote:

 You want the table to pop when there will be results selected?

 If so, I guess you will need some JS. You will need to init the table with 
 a query that prevent any result to be selected (this query will require to 
 be hiden somehow JS this is the tricky part, you will need to clear behind 
 the scene this select NONE creteria when the user will have to input it own 
 query). Then you write a little js that check if there is rows or not in 
 the table and un hide the table when there is row(s)... 

 Richard



 On Thu, Mar 5, 2015 at 7:20 PM, Ron Chatterjee achatte...@gmail.com 
 javascript: wrote:

 I just posted a question in the web2py group. Searching I came to this 
 post. Since you guys worked on this. What if I do like the default search 
 and want to stick with it and display the search box that comes out 
 of SQLFORM.grid or smartgrid but I don't want to display the table 
 underneath. Do you know a way to do that?



 On Thursday, June 5, 2014 at 10:19:16 AM UTC-4, Jim S wrote:

 Just dummy'd up this app quickly.

 Let me know if you have any issues.

 -Jim


 On Wednesday, June 4, 2014 10:24:34 PM UTC-5, JoeCodeswell wrote:

 Dear Richard and Jim,

 Would you both please post your sample code? 

 I am trying to implement an autocomplete search widget on a 
 db.contact.l_name field using SQLFORM.grid.

 Thanks in advance.

 Love and peace,

 Joe

 On Thursday, April 24, 2014 8:10:01 AM UTC-7, Richard wrote:

 I am reading the sqlhtml.py search_widget...

 So I would just pass my function (search widget) like that :

 SQLFORM.grid(...,
search_widget=my_search_widget_function)

 ?

 Thanks

 Richard


 On Thu, Apr 24, 2014 at 10:38 AM, Jim S j...@qlf.com wrote:

 Yes, you definitely can.  

 I don't ever use the default search.

 In a nutshell, you have to create your own search form and then apply 
 the results of that form to the query passed to the grid.  Let me know 
 if 
 you need an example and I'll see if I can put a quick one together for 
 you 
 today.

 -Jim


 On Thursday, April 24, 2014 9:18:39 AM UTC-5, Richard wrote:

 Hello,

 Is it possible to create my own search widget? How does I get the 
 grid to use it?

 Thanks

 Richard

  -- 
 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+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+un...@googlegroups.com javascript:.
 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] .grid() my own search widget possible? How?

2015-03-06 Thread Richard Vézina
What you want I think is plain text search... There is a example using
Whoosh, if you search the google group you should find Massimo email
annoncing it...

Good luck.

Richard

On Fri, Mar 6, 2015 at 10:44 AM, Ron Chatterjee achatterjee...@gmail.com
wrote:

 Basically, quick and dirty way to display the search bar on the top of the
 site using smartgrid without showing the table. Then when someone put a
 query and hit, search, be able to redirect to another page. That way, the
 prototype will be complete without writing a customized search routine.
 Once it works, then I could go do all the hard work of writing up the
 search bar that search through my table based on user query.

 Do you know a way to make a search bar on the top of a page in web2py
 (like one we have on this page or yahoo.com or any other page. Except, I
 don't want the web search. Search based on whats in my table/database), and
 then when someone type something redirect that to a page where the table is
 displayed?

 It should be a very common feature to have since every page I visit now a
 days seem to have a search bar with auto completion on upper right corner.
 It seems I am the only one who needs it. lol. I don't know why its such a
 big deal for web2py community. Why js? Why can't be done using a python
 script or web2py routine? Just curious. Since, my only purpose of using
 python and web2py framework that I don't know jscript that well.

 Ron


 On Friday, March 6, 2015 at 9:08:24 AM UTC-5, Richard wrote:

 You want the table to pop when there will be results selected?

 If so, I guess you will need some JS. You will need to init the table
 with a query that prevent any result to be selected (this query will
 require to be hiden somehow JS this is the tricky part, you will need to
 clear behind the scene this select NONE creteria when the user will have to
 input it own query). Then you write a little js that check if there is rows
 or not in the table and un hide the table when there is row(s)...

 Richard



 On Thu, Mar 5, 2015 at 7:20 PM, Ron Chatterjee achatte...@gmail.com
 wrote:

 I just posted a question in the web2py group. Searching I came to this
 post. Since you guys worked on this. What if I do like the default search
 and want to stick with it and display the search box that comes out
 of SQLFORM.grid or smartgrid but I don't want to display the table
 underneath. Do you know a way to do that?



 On Thursday, June 5, 2014 at 10:19:16 AM UTC-4, Jim S wrote:

 Just dummy'd up this app quickly.

 Let me know if you have any issues.

 -Jim


 On Wednesday, June 4, 2014 10:24:34 PM UTC-5, JoeCodeswell wrote:

 Dear Richard and Jim,

 Would you both please post your sample code?

 I am trying to implement an autocomplete search widget on a
 db.contact.l_name field using SQLFORM.grid.

 Thanks in advance.

 Love and peace,

 Joe

 On Thursday, April 24, 2014 8:10:01 AM UTC-7, Richard wrote:

 I am reading the sqlhtml.py search_widget...

 So I would just pass my function (search widget) like that :

 SQLFORM.grid(...,
search_widget=my_search_widget_function)

 ?

 Thanks

 Richard


 On Thu, Apr 24, 2014 at 10:38 AM, Jim S j...@qlf.com wrote:

 Yes, you definitely can.

 I don't ever use the default search.

 In a nutshell, you have to create your own search form and then
 apply the results of that form to the query passed to the grid.  Let me
 know if you need an example and I'll see if I can put a quick one 
 together
 for you today.

 -Jim


 On Thursday, April 24, 2014 9:18:39 AM UTC-5, Richard wrote:

 Hello,

 Is it possible to create my own search widget? How does I get the
 grid to use it?

 Thanks

 Richard

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

Re: [web2py] .grid() my own search widget possible? How?

2015-03-05 Thread Ron Chatterjee
I just posted a question in the web2py group. Searching I came to this 
post. Since you guys worked on this. What if I do like the default search 
and want to stick with it and display the search box that comes out 
of SQLFORM.grid or smartgrid but I don't want to display the table 
underneath. Do you know a way to do that?



On Thursday, June 5, 2014 at 10:19:16 AM UTC-4, Jim S wrote:

 Just dummy'd up this app quickly.

 Let me know if you have any issues.

 -Jim


 On Wednesday, June 4, 2014 10:24:34 PM UTC-5, JoeCodeswell wrote:

 Dear Richard and Jim,

 Would you both please post your sample code? 

 I am trying to implement an autocomplete search widget on a 
 db.contact.l_name field using SQLFORM.grid.

 Thanks in advance.

 Love and peace,

 Joe

 On Thursday, April 24, 2014 8:10:01 AM UTC-7, Richard wrote:

 I am reading the sqlhtml.py search_widget...

 So I would just pass my function (search widget) like that :

 SQLFORM.grid(...,
search_widget=my_search_widget_function)

 ?

 Thanks

 Richard


 On Thu, Apr 24, 2014 at 10:38 AM, Jim S j...@qlf.com wrote:

 Yes, you definitely can.  

 I don't ever use the default search.

 In a nutshell, you have to create your own search form and then apply 
 the results of that form to the query passed to the grid.  Let me know if 
 you need an example and I'll see if I can put a quick one together for you 
 today.

 -Jim


 On Thursday, April 24, 2014 9:18:39 AM UTC-5, Richard wrote:

 Hello,

 Is it possible to create my own search widget? How does I get the grid 
 to use it?

 Thanks

 Richard

  -- 
 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+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] Grid order for reference fields

2015-01-21 Thread Gael Princivalle
Hello all.

In my grid if the user click on head columns for reference fields the order 
is made by row id and not by the row format.

My db:
db.define_table('l1_categories',
Field('name'),
format = '%(name)s')

db.define_table('l2_categories',
Field('l1_category', 'reference l1_categories'),
Field('name'))

My grid:
query = db.l2_categories
grid = SQLFORM.grid(query=query, csv=False, links_in_grid=False, links=
None, searchable=True, editable=True, deletable=False, create=True, details=
False)

How can I give the possibility to the user when he click on the l1_category 
head column to order it by format ? If there is a solution I think it will 
also give the possibility to search with these words.

Thanks, regards.

-- 
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] grid and expressions

2014-12-20 Thread Manuele Pesenti
Hi *,
why expressions are not accepted by grid while I can use parameter
groupby? I think they could be treated as virtual fields... right?

Thanks

Manuele

-- 
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] grid selectable only select 1 row

2014-11-29 Thread 黄祥
hi,

is it possible grid selectable only select 1 row?
i've tested it but with no luck, e.g.
*controllers/order.py*
def sale_order_detail():
selectable = lambda ids : redirect(URL('sale_order_detail_checkout', vars = 
dict(ids = ids) ) )
#selectable = lambda ids: sale_order_detail_checkout(ids)
grid = SQLFORM.grid(db.sale_order_detail, user_signature = False, 
selectable = selectable)
return locals()
# sale_order_detail_checkout
def sale_order_detail_checkout():
ids = request.vars.ids
return dict(ids = ids)

*views/order/sale_order_detail_checkout.html*
{{extend 'layout.html'}}

{{=SPAN(ids)}}

table class=table table-condensed table-hover
tr
th{{=T('Product') }}/th
th{{=T('ID') }}/th
/tr
{{for id in ids:}}
{{detail = db(db.sale_order_detail.id == id).select().first()}}
tr
td{{=SPAN(detail.product.model.model)}}/td
td{{=SPAN(id)}}/td 
/tr
{{pass}}
/table

*Result*
No Error Occured, but the result is not expected. e.g. if i select multiple 
row it works fine, but when i select only one row (id : 98), the result 
show the content of id : 9 and id : 8

any idea how to solve this?

thanks and best regards,

-- 
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] grid modes

2014-11-20 Thread Alex Glaros
am seeking to display a button in view only if grid is in view mode.

otherwise, button inappropriately pops up in edit mode.

anyone see anything wrong with this code in the view?

{{if request(0) == 'view':}}a class=btn btn-primary href=
add_new_suggestion Post a brand new suggestion/a}}{{pass}


error is:

Request' object is not callable


thanks

Alex Glaros

-- 
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] grid column order

2014-11-17 Thread Alex Glaros
I want the first column in grid to be a link. It's an already-existing 
field in a table and displays in the correct order when not linkable.

Is using represent the only way to make this column in this 
first-position a link?

If I use the links= statement, the column is displayed to the right, 
instead of at the first column on the left.

thanks,

Alex Glaros

-- 
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] grid search on field list:string

2014-10-25 Thread Alen Cerovic
Grid search widget does not show fields with datatype list:.
How to enable searching on these fields in grid search?

-- 
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] GRID selectable inside component

2014-10-15 Thread LaDarrius Stewart
I have a grid inside a component inside a component which has selectable 
set to run a function that assigns the ids to a session variable. When 
inside the component it does not work when i click submit I can tell that 
the page is being reloaded but the callback does not run. I know that the 
code works because if I go to the .load page directly and try it works as 
expected. But from the component page it doesnt execute the callback.



selectable = [('Create Invoice', lambda ids: [selectabletest(ids)], 'btn 
btn-info btn-md')]
grid2 = SQLFORM.grid(query, selectable=selectable, args=request.args[:1], 
formname='invgrid', user_signature=False)

def selectabletest(ids):
session.lambdatest = ids

-- 
This message is for named person(s) only.  It may contain confidential 
and/or legally privileged information.  No confidentiality or privilege is 
waived or lost should mis-transmission occur.  If you receive this message 
in error, delete it (and all copies) and notify the sender.  You must not, 
directly or indirectly,use, disclose, distribute, print, or copy any part 
of this message if you are not the intended recipient. GAD GROUP 
TECHNOLOGY, INC. reserves the right to monitor all e-mail communications 
through its networks.

Any views expressed in this message are those of the individual sender, 
except where the message states otherwise and the sender is authorized to 
state them to be the views of any such entity.

This e-mail has been virus and content scanned by GAD GROUP TECHNOLOGY, INC.

-- 
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: web2py grid auto page

2014-09-22 Thread Dave S


On Saturday, September 20, 2014 9:43:34 PM UTC-7, T.R.Rajkumar wrote:

 I have a SQLFORM.grid. It paginates the returned rows. Now I want to move 
 through all the pages on a set timer interval without clicking the page 
 numbers, i.e I want to auto page like an album without post back using 
 jQuery. How to achieve that. Thank you.


I think for this you'll have to have to use a timer in javascript ; when 
the timer fires, you can emulate having clicked on the button, which is the 
easy way (I think).

As an alternative to paging, I think there have been samples posted to the 
group that demonstrate infinite scrolling, which is essentially using 
jquery and/or AJAX to append a new spoonful of data at the end of the 
current page.   The Google Groups view of this group's topics behaves in 
that way.

Good luck!

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] web2py grid auto page

2014-09-21 Thread T.R.Rajkumar
I have a SQLFORM.grid. It paginates the returned rows. Now I want to move 
through all the pages on a set timer interval without clicking the page 
numbers, i.e I want to auto page like an album without post back using 
jQuery. How to achieve that. Thank you.

-- 
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] web2py grid select all filtred rows

2014-08-14 Thread Manuele Pesenti
Il 13/08/14 21:29, keiser1080 ha scritto:
 so on the controler i can get the rows by doing grid.rows?
yes
 The query is also stored on an accessible grid proprety ?
I don't know. The code of the function that defines the grid is not so
easy to read but you can try to look into it:
https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L1854 (for
grid)
https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2691 (for
smartgrid)

Cheers

M.

-- 
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] web2py grid select all filtred rows

2014-08-13 Thread Manuele Pesenti
Il 12/08/14 19:42, keiser1080 ha scritto:
 Hi,

 is there a way to get the query  or the list of id from a filtred grid?

 for example a grid listing all students with pagination = filter data
 using the search widget of the grid  student.age  20 
  = 2000 rows (multiple pages) =  send data to another page or fonction ?
Resulting rows you see in grid are saved in attribute rows of your
grid object.
Does this help you?

M.

-- 
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] web2py grid select all filtred rows

2014-08-13 Thread keiser1080
thanks for you reply.
I will check tomorro at work.
so on the controler i can get the rows by doing grid.rows?
The query is also stored on an accessible grid proprety ?






-- 
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] web2py grid select all filtred rows

2014-08-12 Thread keiser1080
Hi,

is there a way to get the query  or the list of id from a filtred grid?

for example a grid listing all students with pagination = filter data 
using the search widget of the grid  student.age  20 
 = 2000 rows (multiple pages) =  send data to another page or fonction ?

-- 
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] grid problem

2014-07-30 Thread ceriox
thanks Javier!
but can you explain must be a function?
i use this code in other functions (for other tables) and it work fine!
how i need to change it?



Il giorno martedì 29 luglio 2014 17:51:47 UTC+2, Massimo Di Pierro ha 
scritto:

 good catch!

 On Tuesday, 29 July 2014 10:39:15 UTC-5, Javier Pepe wrote:

 form = SQLFORM.grid(db.t_proposte,
searchable=True,
   deletable=True,
details=False,
 *   selectable**=True,** - must be a function*
csv=True,
   user_signature=False)  # change to True in 
 production


 On Tue, Jul 29, 2014 at 12:05 PM, ceriox cer...@gmail.com javascript: 
 wrote:

 hi all,
 i have a table with some fields (two of the type boolean)

 if i use 
 form = SQLFORM.smartgrid(db.t_proposte,onupdate=auth.archive)


 all work fine!

 but if i use:
 form = SQLFORM.grid(db.t_proposte,
searchable=True,
   deletable=True,
details=False,
selectable=True,
csv=True,
   user_signature=False)  # change to True in 
 production


 i have the error:
 type 'exceptions.TypeError' 'bool' object is not iterable
 i'm doing something wrong?
 (i don't have any type of requires on the fields)

  -- 
 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+un...@googlegroups.com javascript:.
 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] grid problem

2014-07-30 Thread Manuele Pesenti
Il 30/07/14 09:30, ceriox ha scritto:
 thanks Javier!
 but can you explain must be a function?
 i use this code in other functions (for other tables) and it work fine!
 how i need to change it?
Dear ceriox,
I think here lie the problem:
https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2602-L2605

look your self, if selectable is not callable its value is passed to
enumerate function...

you can use selectable=lambda _: True instead

hope it could help
Cheers

Manuele

-- 
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] grid problem

2014-07-30 Thread Anthony
On Wednesday, July 30, 2014 4:59:41 AM UTC-4, Manuele wrote:

 Il 30/07/14 09:30, ceriox ha scritto: 
  thanks Javier! 
  but can you explain must be a function? 
  i use this code in other functions (for other tables) and it work fine! 
  how i need to change it? 
 Dear ceriox, 
 I think here lie the problem: 
 https://github.com/web2py/web2py/blob/master/gluon/sqlhtml.py#L2602-L2605 

 look your self, if selectable is not callable its value is passed to 
 enumerate function... 

 you can use selectable=lambda _: True instead 


You can do the above, but it will make the selection functionality useless 
(unless you are intercepting the submitted request.vars elsewhere 
manually). The selectable argument should be a function that takes the 
list of records selected and then does something with them (e.g., delete 
them). It can also be a list of lists if you want to allow more than one 
possible function to be applied to the list of records (in that case, each 
list should include a button label, a callback function, and a button 
class).

Anthony

 

 hope it could help 
 Cheers 

 Manuele 


-- 
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] grid problem

2014-07-29 Thread ceriox
hi all,
i have a table with some fields (two of the type boolean)

if i use 
form = SQLFORM.smartgrid(db.t_proposte,onupdate=auth.archive)


all work fine!

but if i use:
form = SQLFORM.grid(db.t_proposte,
   searchable=True,
  deletable=True,
   details=False,
   selectable=True,
   csv=True,
  user_signature=False)  # change to True in production


i have the error:
type 'exceptions.TypeError' 'bool' object is not iterable
i'm doing something wrong?
(i don't have any type of requires on the fields)

-- 
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] grid problem

2014-07-29 Thread Javier Pepe
form = SQLFORM.grid(db.t_proposte,
   searchable=True,
  deletable=True,
   details=False,
*   selectable**=True,** - must be a function*
   csv=True,
  user_signature=False)  # change to True in production


On Tue, Jul 29, 2014 at 12:05 PM, ceriox cer...@gmail.com wrote:

 hi all,
 i have a table with some fields (two of the type boolean)

 if i use
 form = SQLFORM.smartgrid(db.t_proposte,onupdate=auth.archive)


 all work fine!

 but if i use:
 form = SQLFORM.grid(db.t_proposte,
searchable=True,
   deletable=True,
details=False,
selectable=True,
csv=True,
   user_signature=False)  # change to True in
 production


 i have the error:
 type 'exceptions.TypeError' 'bool' object is not iterable
 i'm doing something wrong?
 (i don't have any type of requires on the fields)

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


-- 
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] grid problem

2014-07-29 Thread Massimo Di Pierro
good catch!

On Tuesday, 29 July 2014 10:39:15 UTC-5, Javier Pepe wrote:

 form = SQLFORM.grid(db.t_proposte,
searchable=True,
   deletable=True,
details=False,
 *   selectable**=True,** - must be a function*
csv=True,
   user_signature=False)  # change to True in 
 production


 On Tue, Jul 29, 2014 at 12:05 PM, ceriox cer...@gmail.com wrote:

 hi all,
 i have a table with some fields (two of the type boolean)

 if i use 
 form = SQLFORM.smartgrid(db.t_proposte,onupdate=auth.archive)


 all work fine!

 but if i use:
 form = SQLFORM.grid(db.t_proposte,
searchable=True,
   deletable=True,
details=False,
selectable=True,
csv=True,
   user_signature=False)  # change to True in 
 production


 i have the error:
 type 'exceptions.TypeError' 'bool' object is not iterable
 i'm doing something wrong?
 (i don't have any type of requires on the fields)

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




-- 
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] web2py grid Serch and query

2014-07-20 Thread Rohit Raj Sharma
how to limit the list which come by clicking on the sqlgrid default search. 
I have 10 fields in table. i do not want to show all the fields on list of 
default search. Can it possible to customize the list of default search 
widget.

this i can in html drop down, but that is very complex and increase line 
code. i want to use default search widget.  can you help me in that. I do 
not want to hide fields by using 
db.tablename.fieldname.writeable=false.i want to show all fields but list 
of drop down of search should be customize 

and 2 query is in my table i have one status field and blob field to store 
img. i want to show image in grid according to the status.  Suppose if i 
select status High, in blob fields red color image should update , if low 
green color img should update in blob field.

-- 
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] grid: deletion row callback

2014-07-07 Thread Manuele Pesenti
Hi!
is it possible to setup a _javascript_ trigger on grid row deletion
event? Possibly capturing the data of the row that will be deleted?

thank you in advance.
Cheers

Manuele

-- 
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] grid orderby parameter not quite useful for a foreign key column

2014-07-05 Thread 98ujko9
The grid below orders the rows by part_description column only the first 
time the action is called. After that if you click on the header link it 
orders by pp_part_id foreign 
key which is not as useful as it could be by part_description.
Why the link in the header for that column does not receive the orderby 
argument passed to the grid?
Any help or explanation will be appreciated, thanks.
 
fields = [db.partprice.pp_id,
  db.partprice.pp_part_id,
  db.partprice.pp_partnum,
  db.partprice.pp_supp_id,
  db.partprice.pp_unit_price,
  db.partprice.pp_sugg_price,
  db.partprice.pp_intro_date,
  db.partprice.pp_term_date,
  db.partprice.pp_term_id,
  db.partprice.pp_comment
  ]
headers= {'partprice.pp_id':'Price Id',
  'partprice.pp_part_id':'Part',
  'partprice.pp_partnum':'Part Number',
  'partprice.pp_supp_id':'Supplier',
  'partprice.pp_unit_price':'Unit',
  'partprice.pp_sugg_price':'Suggested',
  'partprice.pp_intro_date':'Introduced',
  'partprice.pp_term_date':'Terminated',
  'partprice.pp_term_id':'Termination ID',
  'partprice.pp_comment':'Comment'
  }

db.define_table('part',
Field('part_id','id'),

Field('part_description','string',length=128,label='Description'),
Field('part_intro_date','date',default = 
now,label='Introduced'),
Field('part_term_date','date',label='Terminated'),
Field('part_term_id','integer',default=0,label='Termination 
ID'),
Field('part_comment','string',label='Comment'),
migrate='part.table', format='%(part_description)s'
)
db.define_table('partprice',
Field('pp_id','id',label='Price Id'),
Field('pp_part_id','reference part',label='Part'),
Field('pp_partnum','string',length =50,label='Number'),
Field('pp_supp_id','reference supplier',label='Supplier'),

Field('pp_unit_price','decimal(18,2)',default=0.00,label='Unit'),

Field('pp_sugg_price','decimal(18,2)',default=0.00,label='Suggested'),

Field('pp_intro_date','date',default=now,label='Introduced'),
Field('pp_term_date','date',label='Terminated'),
Field('pp_term_id','integer',default=0,label='Termination 
ID'),
Field('pp_comment','string',label='Comment'),
migrate=False, format='%(pp_part_id)s'
)

left=db.partprice.on(db.part.part_id==db.partprice.pp_part_id)
orderby=[db.part.part_description]
form=SQLFORM.grid(db.partprice,left=left,fields=fields,headers=headers,orderby=orderby,sortable=True,paginate='all')

-- 
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: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-12 Thread Anthony
On Wednesday, June 11, 2014 3:48:15 PM UTC-4, 黄祥 wrote:

 Hi, Anthony, is it possible to combine the represent for change the color 
 depend on the value with the represent for is_in_set translate above?
 e.g.


Sure, instead of SPAN(status, ...) do SPAN(mydict[status], ...).

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: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-12 Thread 黄祥
it works, thank you so much, anthony
e.g.
product_status = {'On Sale': T('On Sale'), 'Hold': T('Hold'), 'Sold': 
T('Sold')}

table.status.represent = lambda status, field: SPAN(product_status[status], 
_class = 'text-success' if status == 'Sold' else 'text-warning' if status 
== 'Hold' else 'text-error')
table.status.requires = IS_IN_SET([('On Sale', T('On Sale') ), ('Hold', 
T('Hold') ), ('Sold', T('Sold') ) ] )

best regards,
stifan

-- 
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] Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-11 Thread Stefan van den Eertwegh
Hi all,

I have a model where a Field has IS_IN_SET({'1':T(''),2:T('')}).

When you have a grid in web2py; When you edit the record you see the value 
(the translatable string).
But when you view the record you see the key of the IS_IN_SET.

IS is possible to have the grid showing the value from the IS_IN_SET in the 
view?

Thank you!

-- 
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: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-11 Thread Anthony
The IS_IN_SET validator affects form widgets but not other displays of the 
values in the field. If you want to change the way a value is displayed in 
a grid (or SQLTABLE), you must use the represent attribute of the field.

Anthony

On Wednesday, June 11, 2014 8:58:54 AM UTC-4, Stefan van den Eertwegh wrote:

 Hi all,

 I have a model where a Field has IS_IN_SET({'1':T(''),2:T('')}).

 When you have a grid in web2py; When you edit the record you see the value 
 (the translatable string).
 But when you view the record you see the key of the IS_IN_SET.

 IS is possible to have the grid showing the value from the IS_IN_SET in 
 the view?

 Thank you!


-- 
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: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-11 Thread Stefan van den Eertwegh
Hi Anthony,

Me and my colleges tried it with represent but we cant figure it out.
Can you give an example how this should work?
The table and column is templates.type (key: value)

Regards,
Stefan van den Eertwegh

Op woensdag 11 juni 2014 16:37:13 UTC+2 schreef Anthony:

 The IS_IN_SET validator affects form widgets but not other displays of the 
 values in the field. If you want to change the way a value is displayed in 
 a grid (or SQLTABLE), you must use the represent attribute of the field.

 Anthony

 On Wednesday, June 11, 2014 8:58:54 AM UTC-4, Stefan van den Eertwegh 
 wrote:

 Hi all,

 I have a model where a Field has IS_IN_SET({'1':T(''),2:T('')}).

 When you have a grid in web2py; When you edit the record you see the 
 value (the translatable string).
 But when you view the record you see the key of the IS_IN_SET.

 IS is possible to have the grid showing the value from the IS_IN_SET in 
 the view?

 Thank you!



-- 
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: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-11 Thread Anthony
mydict = dict(1=T(''), 2=T(''))

db.define_table('mytable',
Field('myfield', represent=lambda v, r: mydict[v]))

Anthony

On Wednesday, June 11, 2014 10:50:06 AM UTC-4, Stefan van den Eertwegh 
wrote:

 Hi Anthony,

 Me and my colleges tried it with represent but we cant figure it out.
 Can you give an example how this should work?
 The table and column is templates.type (key: value)

 Regards,
 Stefan van den Eertwegh

 Op woensdag 11 juni 2014 16:37:13 UTC+2 schreef Anthony:

 The IS_IN_SET validator affects form widgets but not other displays of 
 the values in the field. If you want to change the way a value is displayed 
 in a grid (or SQLTABLE), you must use the represent attribute of the 
 field.

 Anthony

 On Wednesday, June 11, 2014 8:58:54 AM UTC-4, Stefan van den Eertwegh 
 wrote:

 Hi all,

 I have a model where a Field has IS_IN_SET({'1':T(''),2:T('')}).

 When you have a grid in web2py; When you edit the record you see the 
 value (the translatable string).
 But when you view the record you see the key of the IS_IN_SET.

 IS is possible to have the grid showing the value from the IS_IN_SET in 
 the view?

 Thank you!



-- 
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: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-11 Thread Stefan van den Eertwegh
Hi Anthony,

I am sorry but it doesnt work.
Also gives pycharm an error at the rule mydict = dict

Stefan

Op woensdag 11 juni 2014 17:06:06 UTC+2 schreef Anthony:

 mydict = dict(1=T(''), 2=T(''))

 db.define_table('mytable',
 Field('myfield', represent=lambda v, r: mydict[v]))

 Anthony

 On Wednesday, June 11, 2014 10:50:06 AM UTC-4, Stefan van den Eertwegh 
 wrote:

 Hi Anthony,

 Me and my colleges tried it with represent but we cant figure it out.
 Can you give an example how this should work?
 The table and column is templates.type (key: value)

 Regards,
 Stefan van den Eertwegh

 Op woensdag 11 juni 2014 16:37:13 UTC+2 schreef Anthony:

 The IS_IN_SET validator affects form widgets but not other displays of 
 the values in the field. If you want to change the way a value is displayed 
 in a grid (or SQLTABLE), you must use the represent attribute of the 
 field.

 Anthony

 On Wednesday, June 11, 2014 8:58:54 AM UTC-4, Stefan van den Eertwegh 
 wrote:

 Hi all,

 I have a model where a Field has IS_IN_SET({'1':T(''),2:T('')}).

 When you have a grid in web2py; When you edit the record you see the 
 value (the translatable string).
 But when you view the record you see the key of the IS_IN_SET.

 IS is possible to have the grid showing the value from the IS_IN_SET in 
 the view?

 Thank you!



-- 
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: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-11 Thread Anthony
Sorry, do it this way:

mydict = {1: T(''), 2: T('')}

Anthony

On Wednesday, June 11, 2014 11:24:34 AM UTC-4, Stefan van den Eertwegh 
wrote:

 Hi Anthony,

 I am sorry but it doesnt work.
 Also gives pycharm an error at the rule mydict = dict

 Stefan

 Op woensdag 11 juni 2014 17:06:06 UTC+2 schreef Anthony:

 mydict = dict(1=T(''), 2=T(''))

 db.define_table('mytable',
 Field('myfield', represent=lambda v, r: mydict[v]))

 Anthony

 On Wednesday, June 11, 2014 10:50:06 AM UTC-4, Stefan van den Eertwegh 
 wrote:

 Hi Anthony,

 Me and my colleges tried it with represent but we cant figure it out.
 Can you give an example how this should work?
 The table and column is templates.type (key: value)

 Regards,
 Stefan van den Eertwegh

 Op woensdag 11 juni 2014 16:37:13 UTC+2 schreef Anthony:

 The IS_IN_SET validator affects form widgets but not other displays of 
 the values in the field. If you want to change the way a value is 
 displayed 
 in a grid (or SQLTABLE), you must use the represent attribute of the 
 field.

 Anthony

 On Wednesday, June 11, 2014 8:58:54 AM UTC-4, Stefan van den Eertwegh 
 wrote:

 Hi all,

 I have a model where a Field has IS_IN_SET({'1':T(''),2:T('')}).

 When you have a grid in web2py; When you edit the record you see the 
 value (the translatable string).
 But when you view the record you see the key of the IS_IN_SET.

 IS is possible to have the grid showing the value from the IS_IN_SET 
 in the view?

 Thank you!



-- 
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: Web2py grid shows key from IS_IN_SET({key: value}) model

2014-06-11 Thread 黄祥
Hi, Anthony, is it possible to combine the represent for change the color 
depend on the value with the represent for is_in_set translate above?
e.g.
table.status.represent = lambda status, field: SPAN(status, _class = 
'text-success' if status == 'Sold' else 'text-warning' if status == 'Hold' 
else 'text-error')
table.status.requires = IS_IN_SET([('On Sale', T('On Sale') ), ('Hold', 
T('Hold') ), ('Sold', T('Sold') ) ] )

thanks and best regards,
stifan

-- 
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] Grid data is not displayed on using Edit/View in case there are two grids in one view

2014-06-09 Thread Sarbjit
I am using two grids in my application but I have observed that when I use 
Edit/View button for GRID1, then the layout of the grid is not proper (Data 
from Grid1 is not seen) and default layout doesn't seems to be loaded.

NOTE :-

Since web2py doesn't supports two grids in one view, I am using LOAD for 
one gird and second grid is loaded directly. 

Reason, I want to display second grid directly is that I want to customize 
the edit function for the grid.

Below is the sample Code 

*Views :*

{{extend 'layout.html'}}
{{if grid.view_form:}}
{{=grid}}
{{elif grid.update_form:}}
{{=grid}}
{{else:}}
{{=grid}}
{{=LOAD('default','loadGrid1',ajax=True)}}
{{pass}}

*Controller :*

@auth.requires_login()  
def index():
grid = 
SQLFORM.grid(query=db.person,csv=False,create=False,deletable=False,paginate=20,sortable=True)
return dict(grid=grid)

def loadGrid1():
grid1 = 
SQLFORM.grid(query=db.dog,csv=False,create=False,deletable=False,paginate=20,sortable=True)


return grid1

*Model :*

db.define_table('person', 
Field('name'), 
Field('countyry'))

db.define_table('dog',
Field('name'),
Field('ownername'))Models :

Can someone please help me to resolve this issue.

Thanks
Sarbjit


-- 
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] .grid() my own search widget possible? How?

2014-06-04 Thread JoeCodeswell
Dear Richard,

Would you (and Jim) please post your sample code?

Thanks in advance.

Love and peace,

Joe

On Thursday, April 24, 2014 8:10:01 AM UTC-7, Richard wrote:

 I am reading the sqlhtml.py search_widget...

 So I would just pass my function (search widget) like that :

 SQLFORM.grid(...,
search_widget=my_search_widget_function)

 ?

 Thanks

 Richard


 On Thu, Apr 24, 2014 at 10:38 AM, Jim S j...@qlf.com javascript: 
 wrote:

 Yes, you definitely can.  

 I don't ever use the default search.

 In a nutshell, you have to create your own search form and then apply the 
 results of that form to the query passed to the grid.  Let me know if you 
 need an example and I'll see if I can put a quick one together for you 
 today.

 -Jim


 On Thursday, April 24, 2014 9:18:39 AM UTC-5, Richard wrote:

 Hello,

 Is it possible to create my own search widget? How does I get the grid 
 to use it?

 Thanks

 Richard

  -- 
 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+un...@googlegroups.com javascript:.
 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] Web2py grid pagination class set

2014-05-19 Thread Stefan van den Eertwegh
Hi al,

I have a grid in web2py and want a pagination class define to use the 
bootstrap pagination styling.
The parameters pagination_class and paginator_class doesnt work.

Does anyone know how this works?

Thank you!

-- 
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] grid issues

2014-05-01 Thread LaDarrius Stewart
def qadata():

form2=FORM(LABEL(,INPUT(_type=text,_name=lastname,requires=IS_LENGTH(minsize=3),
 
_placeholder=Company Name, _size=35, _style=font-size:15px)),
BUTTON(Submit, _type=submit,_value=Submit, 
_data={'loading-text':'loading'}))
grid=None
db.JRREG00.id.readable=False
if form2.process(session=None, formname='form2').accepted:
lastnamesch = form2.vars.lastname.strip(' \t\n\r')
rows = ((db.JRREG00.Company_Name.like(str(lastnamesch) + '%')))
links = [lambda row: A(BUTTON('Details!'), 
_href=URL('default','qacompanypage',args=row.id))]
grid=SQLFORM.grid(rows, buttons_placement = 'left', links_placement 
= 'left', links=links, deletable=False, paginate=6,
  
create=False,editable=False,details=False,searchable=False,csv=False, 
maxtextlength=35, user_signature=True)
return locals()

Currently im displaying a grid from a query thats created after a form is 
filled. But with this approach im not able to go to next page or paginate 
or use links like details etc. I know I have them disabled but the issue 
still stands because its the same issue causing the pagination not to work. 
If you click on another page of the grid it brings back the original page 
with no grid information. I'm sure someone is going to ask why I didnt use 
the search that comes with the grid two reasons.
1) I dont want the auto execute of grids that bring back records before a 
search is executed.
2) I dont want users to have ability to search by different columns.

If I didn't explain that well let me know ill show an example.


-- 
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] .grid() my own search widget possible? How?

2014-04-24 Thread Richard
Hello,

Is it possible to create my own search widget? How does I get the grid to 
use it?

Thanks

Richard

-- 
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] .grid() my own search widget possible? How?

2014-04-24 Thread Jim S
Yes, you definitely can.  

I don't ever use the default search.

In a nutshell, you have to create your own search form and then apply the 
results of that form to the query passed to the grid.  Let me know if you 
need an example and I'll see if I can put a quick one together for you 
today.

-Jim


On Thursday, April 24, 2014 9:18:39 AM UTC-5, Richard wrote:

 Hello,

 Is it possible to create my own search widget? How does I get the grid to 
 use it?

 Thanks

 Richard


-- 
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] .grid() my own search widget possible? How?

2014-04-24 Thread Richard Vézina
I am reading the sqlhtml.py search_widget...

So I would just pass my function (search widget) like that :

SQLFORM.grid(...,
   search_widget=my_search_widget_function)

?

Thanks

Richard


On Thu, Apr 24, 2014 at 10:38 AM, Jim S j...@qlf.com wrote:

 Yes, you definitely can.

 I don't ever use the default search.

 In a nutshell, you have to create your own search form and then apply the
 results of that form to the query passed to the grid.  Let me know if you
 need an example and I'll see if I can put a quick one together for you
 today.

 -Jim


 On Thursday, April 24, 2014 9:18:39 AM UTC-5, Richard wrote:

 Hello,

 Is it possible to create my own search widget? How does I get the grid to
 use it?

 Thanks

 Richard

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


-- 
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] Grid 2 list boxes first list box to restrict values in second

2014-03-20 Thread Dan Kozlowski
Is there any way within a grid with 2 list boxes that the selected value in 
the first list box can sub select the the second the values in the listbox 
? A example would be selecting a state and only selecting cities in that 
state.


Example :


State : IL

Cites : Chicago
   Calumet City
   Lansing

Then if you select 

State : IN

Cities : Schererville
   St. John
   Ceder Lake



-- 
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] grid coloum width

2014-03-10 Thread 黄祥
hi,

i have the table field data that using represent on it but the coloumn 
width it's seems affected by the table field header.
e.g.
db.define_table('supplier', 
Field('name'), 
Field('address', 'text'), 
Field('phone', 'list:string'), 
Field('email', 'list:string'), 
Field('ym', 'list:string'), 
Field('website'), 
Field('contact_person'),
Field('notes', 'text'), 
format = '%(name)s')
db.supplier.ym.represent = lambda ym, field: \
XML(, .join([A(IMG(_title=T(Chat with %s) % yahoo, _alt=T(Chat with 
%s) % yahoo, 
 
_src=http://opi.yahoo.com/online?u=%samp;amp;m=gamp;amp;t=1amp;amp;l=us; 
% yahoo), 
 _target=_blank, _href=ymsgr:sendIM?%s % yahoo).xml() for yahoo in ym]) 
)

with the code above, the ym image shown is so small (affected by the field 
header ('ym') ). trying to put the width on the img html helper is not 
affected at all. is there a way i can make the ym image to normal size?

best regards,
stifan

-- 
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] Grid in component edit twice issue

2014-01-15 Thread Jim Karsten
I have a grid inside a component. When I click the 'Edit' button on a row, 
submit the Edit form, then click the 'Edit' button a second time, the page 
reloads with only the component. 

Controllers: 
def index(): 
Container controller. 
return dict() 

def people(): 
 Grid controller. 
 grid = SQLFORM.grid(db.person) 
 return dict(grid=grid) 

View: index.html 
{{extend 'layout.html'}} 
{{=LOAD(c='mycontroller', f='people', extension='load', ajax=True)}}

View: people.load 
{{=grid}} 

After some digging I suspect the problem is because *request.cid* gets 
reset to *None*. 
I am using web2py version: 2.8.2 

Any suggestions or is this a bug. 
Jim

-- 
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] Grid back button for custom single view

2013-12-29 Thread Gael Princivalle
Hi all.

I've made a custom grid single view, that is in the same html page where I 
call the complete grid.
When I call for request.env.http_referer for going back to the previous 
page I have inside the current page, not the previous one, the same html 
page but with the grid.
For example I make a search in the grid and I have:
http://.../default/products_listing?keywords=od

I click on a single view and I have:
http://.../default/products_listing/view/products/376?keywords=od

If I click on my back button I have again:
http://.../default/products_listing/view/products/376?keywords=od

I want to have:
http://.../default/products_listing?keywords=od

How can I make a back button ?

{{if request.args and request.args[-3] == 'view':}}
{{=P(grid.view_form.record.code)}}
{{=P(grid.view_form.record.description)}}
a class=button btn href={{request.env.http_referer}}Back/a
{{else:}}
{{=grid}}
{{pass}}

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] grid with dictionary

2013-12-06 Thread Diego Tostes
Hi,

Is it possible create a grid like SQLform.grid using a dictionay instead of
a query result?

Rgds,

Diego

-- 
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] grid links appearing in details

2013-11-15 Thread Mirko
Hi all,
I have grid links appearing in details, on the same row than the 'back' 
and 'edit' buttons.
How can I make them not display ?
Thanks !
Mirko

-- 
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] grid exception, what is wrong?

2013-10-29 Thread Marin Pranjić
This is the code:

query=db.customer_code
codes=SQLFORM.grid(query, left=db.file_queue.on(db.file_queue.code_id==
db.customer_code.id))


On 2.7.1 it prints exception in grid (html). On 2.7.4 and trunk it raises a 
ticket. Is this change intentional?

And why is this not working?

Exception is:

type 'exceptions.AttributeError' 'Row' object has no attribute 'uuid'

While 2.7.1 would print:

Query Not Supported: ('ERROR', '42703', 'column file_queue.uuid does not 
exist')


Marin

-- 
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] grid in component only works in Firefox

2013-10-21 Thread Jim S
I have the following in my component controller:

form = SQLFORM.factory(Field('productSiteId', db.productSite, 
label='Add-on',
 required=True, requires=requires),
   Field('quantity', 'decimal(9,4)', label='at'),
   _id='addonForm',
   _formname='addonForm')

if form.process(formname='addonForm').accepted:

When new record is added to the controller the form.process...  works fine 
if using Firefox, but not when using Chrome/Opera or IE.  What am I missing 
to make this work reliably?  The other three browsers all return False when 
adding a new record.  Firefox processes it as I'd expect it to.

-- 
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] grid: readable for columns and backgroundcolors for rows

2013-10-20 Thread Martin Weissenboeck
Hi,

I have a SQLFORM.grid with details=True. A click on the details-ikon (the
magnifier) shows another TABLE or SQLFORM.

Two problems:

(1) I have one column with a lot details, which should not be visible in
the grid, but should be visible in the second table/sqlform.

(2) I want to have even/odd colored rows: the grid shows two colors as
background, the table only one.

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


[web2py] grid layout problem

2013-10-08 Thread stefaan
Hello all,

I noticed the following when using a grid with some links (custom 
buttons) put at the left,
using the default layout (and using ui-style web2py):

- when the grid is on a large screen, the custom button column takes too 
much space
- on a small screen, the custom buttons overlap with the text in the next 
column of the grid

I have attached 2 screenshots illustrating the problem. 
Is this a problem with web2py's default css ? Or do I need to use different 
grid options?

I create the grid with the following options:

form = SQLFORM.grid(ui='web2py',
formname='formindex',
fields=[db.t_seminar.f_date, 
db.t_seminar.f_start_time, db.t_seminar.f_speaker_string, 
db.t_seminar.f_location_string, 
db.t_seminar.f_title_string,db.t_seminar.created_by],
query=((db.t_seminar.f_date = 
datetime.datetime.now().date())  (db.t_seminar.f_tentative != True)),
onupdate=__archive_and_reload,
editable=__userowned,
create=auth.has_membership('admin'),
deletable=__userowned,
details=True,
searchable=True,
sortable=True,
orderby = [db.t_seminar.f_date, 
db.t_seminar.f_start_time, db.t_seminar.f_title_string],
links = [__define_button, __attendants],
buttons_placement=left,
links_placement=left,
paginate=10)

Best regards,
Stefaan.


https://lh5.googleusercontent.com/-bMVSBL5HjJk/UlPyZYkkLjI/ASs/af-4CTzhe4U/s1600/overlap.png

https://lh5.googleusercontent.com/-2hrq-wqeeUA/UlPyebasP2I/AS0/kc9CK-WVlPg/s1600/toomuch.png

-- 
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] Grid console with rows per page selector

2013-10-01 Thread Cliff Kachinske
I'm modifying the SQLFORM.grid console to include a rows per page selector. 
It seems like a natural thing to have there.

I have some questions about the code that builds the search widget. 

Near line 2153 I find this:
search_widget = lambda sfield, url: *CAT(*FORM(
INPUT(_name='keywords', _value=request.vars.keywords,
  _id=skeywords_id, ...

Why call CAT() here? Wouldn't DIV() do the same thing?

Near line 2163 there is this:
form = search_widget and search_widget(sfields, url()) or ''
What does this line of code do?

Thank you,
Cliff Kachinske

-- 
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] grid, smartgrid and ignore_default_filters

2013-09-27 Thread Martin Weissenboeck
Hi,
I am using default filters at many places. Now I want to bulid a grid or a
smartgrid, but I have to set ignore_default_filters=True. How can it be
done? The parameterquery seems not be the right way.

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


[web2py] Grid title

2013-09-24 Thread Warren Block
On both 2.5.1 and 2.6.4, grids are rendered with the name of the 
variable visible.  For example:


def index():
grid = SQLFORM.grid(db.names,
fields = [db.names.lastname, db.names.firstname])
return locals()

On screen, this renders (roughly) as:

  grid : _ Search Clear


That grid is the name of the form variable, and it's really not doing 
anything useful.  The book examples do not show it, so maybe it's 
something new or I've broken the CSS somehow.  Can it be removed?


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


  1   2   3   >