Actually, to make the code more clear and to avoid issues with changing
subscripts, it's generally best to use the .elements() and .element()
methods rather than subscripting. In the past, however, this didn't work if
you needed to replace or remove an element, but now you can do that as
well. In this case, you can do:
grid.element('.web2py_counter', replace=None)
Anthony
On Monday, September 3, 2012 4:08:54 AM UTC-4, Mandar Vaze wrote:
>
> I understand this is quite old thread - posting so that it may be relevant
> for others ..
>
> While I was using about "Version 2.00.0 (2012-07-26 06:06:10) dev" from
> github, instead of *grid[0][2]* I had to use *grid[0][1]*
> When I upgraded to "Version 2.0.2 (2012-08-30 04:08:18) stable" - The
> above code started given me an error "list index out of range"
> Little debugging showed me that now the "records found" was at *grid[0][0]
> *
>
> My code given below for reference. (Following code did *not* change
> between the two versions of web2py, except grid[0][]0] which was grid[0][1]
> earlier.)
>
> grid = SQLFORM.grid(somequery, create=False, deletable=False,
> searchable=False, csv=False, editable=False, details=
> False,
> sortable=False, fields=[db.table.field1, db.table.field2
> ])
> if somequery.count() > 0:
>
> del grid[0][0] # Delete "n records found" text
>
>
> -Mandar
>
> P.S : I understand that I'm using only the SQLFORM portion of SQLGRID
> (details, edit and delete all set to false), but that is a problem to be
> solved another day ...
>
>
> On Sunday, October 30, 2011 7:51:01 PM UTC+5:30, Anthony wrote:
>>
>> You can also get rid of it using server side DOM manipulation:
>>
>> del grid[0][2] # the web2py_counter div is the third component within
>> the first div of the returned grid object
>>
>> Anthony
>>
>> On Sunday, October 30, 2011 6:00:12 AM UTC-4, peter wrote:
>>>
>>> I am hoping that the developers of SQLFORM.grid will add an option to
>>> hide the 'nn records found' message. In fact I do not think it should
>>> appear at all when there is no search in place. I have discovered a
>>> neat way of hiding this message
>>> Put in your layout.html (or more locally if you wish)
>>> <style>
>>> .web2py_counter { display:none}
>>> </style>
>>>
>>> Put it just before {{include}}
>>> Unfortunately it leaves a gap, but it is much better way of getting
>>> rid of the message than editing gluon.
>>>
>>> Peter
>>
>>
--