powerTable AttributeError: 'DAL' object has no attribute 'virtual'

Showing 21-54 of 54 messages
powerTable AttributeError: 'DAL' object has no attribute 'virtual' visuallinux 9/30/12 6:11 PM
Dear All.

I am trying to use PowerTable, but i am receiving the follow error:

Traceback (most recent call last):
  File "/home/fvillarroel/www/web2py/gluon/restricted.py", line 209, in restricted
    exec ccode in environment
  File "/home/fvillarroel/www/web2py/applications/administrador/controllers/clientes.py", line 107, in <module>
  File "/home/fvillarroel/www/web2py/gluon/globals.py", line 185, in <lambda>
    self._caller = lambda f: f()
  File "/home/fvillarroel/www/web2py/gluon/tools.py", line 2783, in f
    return action(*a, **b)
  File "/home/fvillarroel/www/web2py/applications/administrador/controllers/clientes.py", line 63, in clientes
    table=powerTable.create()
  File "/home/fvillarroel/www/web2py/applications/administrador/models/plugin_powertable.py", line 704, in plugin_powertable
    PowerTable(),
  File "/home/fvillarroel/www/web2py/applications/administrador/models/plugin_powertable.py", line 178, in __init__
    headers[c] = sqlrows.db[t][f].label
  File "/home/fvillarroel/www/web2py/gluon/dal.py", line 7136, in __getitem__
    return self.__getattr__(str(key))
  File "/home/fvillarroel/www/web2py/gluon/dal.py", line 7143, in __getattr__
    return ogetattr(self, key)
AttributeError: 'DAL' object has no attribute 'virtual'


Any idea.


Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 9/30/12 7:00 PM
I think it should be Virtual, not virtual.
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' visuallinux 9/30/12 7:32 PM
Dear Massimo.

My code is the following:

@auth.requires_membership('Administrador')
def clientes():


    class Virtual(object):

        @virtualsettings(label=T('Editar'))
        def edit(self):
            
            link_editar= URL(r =request,f='editablefunction',
                            args=[self.clientes.id])
            link_icono_editar= IMG(_src=URL(r=request,c='static',
                        f='images/Edit_Icon.png'),
                        _alt='Editar'
                        )
            return (A(link_icono_editar,_href= link_editar))# + str(self.clientes.id))) 

   reg=db(db.clientes).select(db.clientes.id,db.clientes.rut,db.clientes.dv,db.clientes.rsocial,
                                db.clientes.direccion,db.clientes.ciudad,db.clientes.mail,
                                db.clientes.tipo,db.clientes.fecha,db.clientes.giro,db.tarifa.nombre,
                                db.estados.nombre,db.clientes.tarifica,
            join=(db.tarifa.on(db.clientes.id_tarifa==db.tarifa.id),
                    db.estados.on(db.clientes.estado==db.estados.id),
                    db.tipos.on(db.clientes.tipo==db.tipos.id),
                    db.tarificacion.on(db.clientes.tarifica==db.tarificacion.id)),

            orderby=db.clientes.rsocial)

    powerTable = plugins.powerTable
    powerTable.datasource = reg
    .............
    .............
    table=powerTable.create()
    return dict(table=table)


I do not understand what is wrong.

--- On Sun, 9/30/12, Massimo Di Pierro <massimo....@gmail.com> wrote:

From: Massimo Di Pierro <massimo....@gmail.com>
Subject: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'
To: web...@googlegroups.com
Date: Sunday, September 30, 2012, 11:00 PM

I think it should be Virtual, not virtual.

On Sunday, 30 September 2012 20:11:34 UTC-5, visuallinux wrote:
Dear All.

I am trying to use PowerTable, but i am receiving the follow error:

Traceback (most recent call last):
  File "/home/fvillarroel/www/web2py/ gluon/restricted.py", line 209, in restricted
    exec ccode in environment
  File "/home/fvillarroel/www/web2py/ applications/administrador/ controllers/clientes.py", line 107, in <module>
  File "/home/fvillarroel/www/web2py/ gluon/globals.py", line 185, in <lambda>
    self._caller = lambda f: f()
  File "/home/fvillarroel/www/web2py/ gluon/tools.py", line 2783, in f
    return action(*a, **b)
  File "/home/fvillarroel/www/web2py/ applications/administrador/ controllers/clientes.py", line 63, in clientes
    table=powerTable.create()
  File "/home/fvillarroel/www/web2py/ applications/administrador/ models/plugin_powertable.py", line 704, in plugin_powertable
    PowerTable(),
  File "/home/fvillarroel/www/web2py/ applications/administrador/ models/plugin_powertable.py", line 178, in __init__
    headers[c] = sqlrows.db[t][f].label
  File "/home/fvillarroel/www/web2py/ gluon/dal.py", line 7136, in __getitem__
    return self.__getattr__(str(key))
  File "/home/fvillarroel/www/web2py/ gluon/dal.py", line 7143, in __getattr__
    return ogetattr(self, key)
AttributeError: 'DAL' object has no attribute 'virtual'


Any idea.


--
 
 
 
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' rochacbruno 9/30/12 9:04 PM
Are you running new version of web2py? I guess the old style virtual fields is not working and also I have to check if the injection of virtualsettings will still work with web2py 2.0+

I will take a closer look on powertable code tomorrow to see if I can adapt it to work with the new web2py.
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' visuallinux 10/1/12 6:37 AM
Dear Bruno.

Yes effectively i am using the new version of web2py 2.0.8

--- On Mon, 10/1/12, Bruno Rocha <rocha...@gmail.com> wrote:

From: Bruno Rocha <rocha...@gmail.com>
Subject: Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'
To: web...@googlegroups.com
Date: Monday, October 1, 2012, 1:04 AM

Are you running new version of web2py? I guess the old style virtual fields is not working and also I have to check if the injection of virtualsettings will still work with web2py 2.0+

I will take a closer look on powertable code tomorrow to see if I can adapt it to work with the new web2py.

--
 
 
 
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/1/12 10:23 AM
Can you please try the trunk version?
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Wes H 10/1/12 12:33 PM
I have been having the same issue and was able to try trunk just now.

The error persists.

My working powerTable code on 1.99.3 no longer works on 2.0.9.
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/1/12 2:05 PM
Are you storing a rows object in a session? Do you have DAL in modules instead of models? Do you have multiple db=DAL() statements?
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' tomt 10/2/12 6:52 PM
I also have been having the same issue.  I'm running web2py 2.0.9
I only have one db = DAL statement.
All of my DAL is in models/db.py.  I don't have any files in the modules directory.
I haven't specifically stored a rows object in session, although the controller does have a couple of the following statements.
if form.accepts(request.vars,session, dbio=False):
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' visuallinux 10/3/12 12:26 PM
Dear Bruno

Any update about powerTable + Web2py 2.0.9


--- On Mon, 10/1/12, Bruno Rocha <rocha...@gmail.com> wrote:

From: Bruno Rocha <rocha...@gmail.com>
Subject: Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'
To: web...@googlegroups.com

Date: Monday, October 1, 2012, 1:04 AM

Are you running new version of web2py? I guess the old style virtual fields is not working and also I have to check if the injection of virtualsettings will still work with web2py 2.0+

I will take a closer look on powertable code tomorrow to see if I can adapt it to work with the new web2py.

--
 
 
 
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Don_X 10/8/12 6:52 AM

PowerGrid  works with the latests web2py 2+ ..... while Powertable does not

I was wondering what the real differences are between these 2 powerfull plugins

they both seems to do basically the same things ... but PowerTable looks much better  and seems to have more options ... !

the app example for powertable does not work in web2py ...

the one named :  web2py.app.skrywer_powertable.w2p 

 I tried to test it yersterday  .. but does not work !
I get the following error on 2.0.9

<type 'exceptions.AttributeError'> 'Row' object has no attribute 'product'


Version  

web2py™(2, 0, 9, datetime.datetime(2012, 10, 2, 3, 55, 58), 'dev')
PythonPython 2.7.3: /usr/bin/python

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Traceback (most recent call last
):
 
File "/home/www-data/web2py/gluon/restricted.py", line 209, in restricted
   
exec ccode in environment
  File
"/home/www-data/web2py/applications/powertable/controllers/default.py", line 80, in <module>
 
File "/home/www-data/web2py/gluon/globals.py", line 186, in <lambda>
   
self._caller = lambda f: f()
 
File "/home/www-data/web2py/applications/powertable/controllers/default.py", line 25, in index
    table
= table.create()
 
File "/home/www-data/web2py/applications/powertable/models/plugin_powertable.py", line 810, in plugin_powertable
    PowerTable
(),
 
File "/home/www-data/web2py/applications/powertable/models/plugin_powertable.py", line 214, in __init__
    _id
= record[keycolumntbl][keycolumnfld]
 
File "/home/www-data/web2py/gluon/dal.py", line 6369, in __getitem__
   
return ogetattr(self, key)
AttributeError: 'Row' object has no attribute 'product'

I was planning on  using the powertable for my soccer app ... it seems I'll have to do it with powergrid instead ...

Any news on powertable ??? ...

Bruno ... if I was half as good as you .. I would of helped you maintain this beauty ! .. i watched your vimeo cast  about it ... it is simply powerfull ...and would be very usefull to me !

Don
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/8/12 7:19 AM
Please use the latest trunk or nightly built. This problem has been fixed yesterday.
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Don_X 10/8/12 8:32 AM
Massimo,

the latest trunk or nightly build ... they do not run for now !
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Don_X 10/8/12 8:44 AM
it runs by  bypassing the admin/default/index page ...
but F.Y.I

the powertable app example still does not run : I get the following error :


<type 'exceptions.AttributeError'> 'Row' object has no attribute 'product'


Version

web2py™(2, 1, 0, datetime.datetime(2012, 10, 8, 15, 17, 50), 'dev')
PythonPython 2.7.3: /usr/bin/python



Traceback



1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
Traceback (most recent call last):
 
File "/home/www-data/web2py/gluon/restricted.py", line 209, in restricted
   
exec ccode in environment
  File
"/home/www-data/web2py/applications/powertable/controllers/default.py", line 80, in <module
>
 
File "/home/www-data/web2py/gluon/globals.py", line 187, in <lambda>
   
self._caller = lambda f: f()
 
File "/home/www-data/web2py/applications/powertable/controllers/default.py", line 25, in index
    table
= table.create()
 
File "/home/www-data/web2py/applications/powertable/models/plugin_powertable.py", line 810, in plugin_powertable
    PowerTable
(),
 
File "/home/www-data/web2py/applications/powertable/models/plugin_powertable.py", line 214, in __init__
    _id
= record[keycolumntbl][keycolumnfld]
 
File "/home/www-data/web2py/gluon/dal.py", line 6376, in __getitem__
   
return ogetattr(self, key)
AttributeError: 'Row' object has no attribute 'product'

I wish I knew how to fix this ! ... I will try though !

Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/8/12 9:55 AM
The error is that in plugin_powertable.py there are these lines:

                try:
                    headers[c] = sqlrows.db[t][f].label
                except KeyError:

They should be changed to

                try:
                    headers[c] = sqlrows.db[t][f].label
                except (KeyError, AttributeError):

The fact is that table[f] when f is an invalid key now raises an AttributeError, not a KeyError. That is because table[f] is the same as getattr(table,f). While we can change and revert this behavior, making table['f'] equivalent to table.f instead of vice versa resulted in a 10x improvement while extracting data from DAL.
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/8/12 9:59 AM
Or better this should be:

                table = sqlrows.db[t]
                if f in table.fields:
                    headers[c] = table[f].label
                else:
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Don_X 10/8/12 10:07 AM
Thank you Massimo .. but the same error persists  ... with both suggestions !
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/8/12 10:10 AM
Can you show a complete traceback and a code snipped of powertable? I guess my version of powertable does not match yours or the error is now at a different line.
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Don_X 10/8/12 10:23 AM

Same as above Massimo ... it gives the exact same traceback as above ...

and the lines that I have changed are from line no 177 to 185 as follows :
      elif headers=='labels':
            headers
= {}
           
for c in columns:
               
(t,f) = c.split('.')

                table
= sqlrows.db[t]
               
if f in table.fields:
                    headers
[c] = table[f].label
               
else:

                    headers
[c] = virtuallabels.get(c,capitalizefieldname(c))

 
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' rochacbruno 10/8/12 10:33 AM
Hi Don,

I will try to reproduce it here and maybe make some updates to plugin.

Can you give me a full code sample? The basic model you are using, the powerTable options etc.. (if you can put on a pastebin)

Thanks
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/8/12 10:34 AM
It cannot be. The former traceback said:

  File "/home/fvillarroel/www/web2py/applications/administrador/models/plugin_powertable.py", line 178, in __init__ 

    headers[c] = sqlrows.db[t][f].label 

now this line does not exist any more. Please report the complete traceback.
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Don_X 10/8/12 10:39 AM
For a more detailed report .. I have openned up the last line pertaining to the plugin_powertable.py below :



  •            
    Function argument list          

    ()

                       
    Code listing

               
               
    20.
    21.
    22.
    23.
    24.
    25.

    26.
    27.
    28.
    29.
        table.showkeycolumn = False
       
    table.extra = dict(
                           
    details={'detailscallback':URL('myfunction.load')}
                           
    )

        table = table.create()


       
    return locals()

               
    Variables

             
               
    table<Storage {'keycolumn': 'product.id', 'extra': {'...te': <function plugin_powertable at 0xa762e144>}>
    table.create<function plugin_powertable>
     
  •  

                File /home/www-data/web2py/applications/powertable/models/plugin_powertable.py in plugin_powertable at line 811
               
    code
               
    arguments
               
    variables          

    Function argument list

               

    ()

             
    Code listing
           
    806.
    807.
    808.
    809.
    810.
    811.

    812.
    813.
    814.
    815.
                                            ifunctions=str(ifunctions),
                                           
    searchcolumnjs=str(searchcolumnjs)
                                           
    )
                             
    ),
                       
    CSS,
                        PowerTable(),

                       
    )


    plugins.powerTable.create = plugin_powertable
           
    Variables

               
    global PowerTable<class '__restricted__.PowerTable'>
       

  •          

                File /home/www-data/web2py/applications/powertable/models/plugin_powertable.py in __init__ at line 215
               
    code
               
    arguments
               
    variables          


    Function argument list

               

    (self=<__restricted__.PowerTable object>)

             
    Code listing

               
               
    210.
    211.
    212.
    213.
    214.
    215.

    216.
    217.
    218.
    219.
                else:
                   
    _title = T('Record %s' % str(rc+1))

               
    #setting the id and key for every <tr> based on required keycolumn
               
    try:

                    _id = record[keycolumntbl][keycolumnfld]

               
    except KeyError:
                   
    if virtualfields:
                       
    _id = record[sqlrows.colnames[0].split('.')[0]].id
                   
    else:

               
    Variables

     
             
    record<Row {'description': 'LCD TV', 'quantity': 34, '...ter object at 0xa757f98c>, 'name': 'Television'}>
    _idundefined
    keycolumntbl'product'
    keycolumnfld'id'
       

  •             File /home/www-data/web2py/gluon/dal.py in __getitem__ at line 6376
               
    code
               
    arguments
               
    variables          

    Function argument list

               

    (self=<Row {'description': 'LCD TV', 'quantity': 34,
    '
    ...ter object at 0xa757f98c>, 'name': 'Television'}>,
    key
    ='product')

           
    Code listing
             
    6371.
    6372.
    6373.
    6374.
    6375.
    6376.

    6377.
    6378.
    6379.
    6380.
            elif m:
               
    try:
                   
    return ogetattr(
...
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Don_X 10/8/12 10:43 AM

Bruno .. I am using the app example from your bitbucket

the web2py.app.skrywer_powertable.w2p 
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/8/12 10:49 AM
Now the error is at a different line. The previous error has been fixed. Now it is at line 215:

            try:
                _id = record[keycolumntbl][keycolumnfld]
           
except KeyError:

as before it should be

            try:
                _id = record[keycolumntbl][keycolumnfld]
           
except (KeyError, AttributeError):


  •         elif m:
               
    try:
                   
    return ogetattr(self, m.group(1))[m.group(2)]
               
    except (KeyError,AttributeError,TypeError):
                   
    key = m.group(2)
            return ogetattr(self, key)


       
    def __setitem__(self, key, value):
           
    setattr(self, str(key), value)
             
    Variables

                   
    self
    <Row {'description': 'LCD TV', 'quantity': 34, '...ter object at 0xa757f98c>, 'name': 'Television'}>
    global ogetattr<slot wrapper '__getattribute__' of 'object' objects>
    key'product'


Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Don_X 10/8/12 10:53 AM
BINGO ! - IT WORKS LIKE A CHARM MASSIMO !!! ... 

Thank you ... now  I can study this properly so I can adapt it to my app !
Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' Massimo Di Pierro 10/8/12 1:15 PM
:-)

On Monday, 8 October 2012 12:53:27 UTC-5, Don_X wrote:
BINGO ! - IT WORKS LIKE A CHARM MASSIMO !!! ... 

Thank you ... now  I can study this properly so I can adapt it to my app !

On Monday, October 8, 2012 1:49:09 PM UTC-4, Massimo Di Pierro wrote:
Now the error is at a different line. The previous error has been fixed. Now it is at line 215:

            try:
                _id = record[keycolumntbl][keycolumnfld]
           
except KeyError:

as before it should be

            try:
                _id = record[keycolumntbl][keycolumnfld]
           
except (KeyError, AttributeError):



On Monday, 8 October 2012 12:39:09 UTC-5, Don_X wrote:
For a more detailed report .. I have openned up the last line pertaining to the plugin_powertable.py below :



  •            
    Function argument list          

    ()

                       
    Code listing

               
               
    20.
    21.
    22.
    23.
    24.
    25.

    26.
    27.
    28.
    29.
        table.showkeycolumn = False
       
    table.extra = dict(
                           
    details={'detailscallback':URL('myfunction.load')}
                           
    )

        table = table.create()


       
    return locals()

               
    Variables

             
               
    table<Storage {'keycolumn': 'product.id', 'extra': {'...te': <function plugin_powertable at 0xa762e144>}>
    table.create<function plugin_powertable>
     
  •  

                File /home/www-data/web2py/applications/powertable/models/plugin_powertable.py in plugin_powertable at line 811
               
    code
               
    arguments
               
    variables          

    Function argument list

               

    ()

             
    Code listing
           
    806.
    807.
    808.
    809.
    810.
    811.

    812.
    813.
    814.
    815.
                                            ifunctions=str(ifunctions),
                                           
    searchcolumnjs=str(searchcolumnjs)
                                           
    )
                             
    ),
                       
    CSS,
                        PowerTable(),

                       
    )


    plugins.powerTable.create = plugin_powertable
           
    Variables

               
    global PowerTable<class '__restricted__.PowerTable'>
       

  •          

                File /home/www-data/web2py/applications/powertable/models/plugin_powertable.py in __init__ at line 215
               
    code
               
    arguments
               
    variables          


    Function argument list

               

    (self=<__restricted__.PowerTable object>)

             
    Code listing

               
               
    210.
    211.
    212.
    213.
    214.
    215.

    216.
    217.
    218.
    219.
                else:
                   
    _title = T('Record %s' % str(rc+1))

               
    #setting the id and key for every <tr> based on required keycolumn
               
    try:
                    _id = record[keycolumntbl][keycolumnfld]

               
    except KeyError:
                   
    if virtualfields:
                       
    _id = record[sqlrows.colnames[0].split('.')[0]].id
                   
    else:

               
    Variables

     
             
    record<Row {'description': 'LCD TV', 'quantity': 34, '...ter object at 0xa757f98c>, 'name': 'Television'}>
    _idundefined
    keycolumntbl'product'
    keycolumnfld'id'
       

  •             File /home/www-data/web2py/gluon/dal.py in __getitem__ at line 6376
               
    code
               
    arguments
               
    variables          

    Function argument list

               

    (self=<Row {'description': 'LCD TV', 'quantity': 34,
    '
    ...ter object at 0xa757f98c>, 'name': 'Television'}>,
    key
    ='product')

           
    Code listing
             
    6371.
    6372.
    6373.
    6374.
    6375.
    6376.

    6377.
    6378.
    6379.
    6380.
            elif m:
               
    try:
                   
    return ogetattr(self, m.group(1))[m.group(2)]
               
    except (KeyError,AttributeError,TypeError):
                   
    key = m.group(2)
            return ogetattr(self, key)


       
    def __setitem__(self, key, value):
           
    setattr(self, str(key), value)
             
    Variables

                   
    self<Row {'description': 'LCD TV', 'quantity': 34, '...ter object at 0xa757f98c>, 'name': 'Television'}>
    global ogetattr<slot wrapper '__getattribute__' of 'object' objects>
    key'product'


Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' tomt 10/8/12 3:53 PM
Thanks to everybody for fixing this!

You might also want to make a similar change at about line 244:
 
               try:
                    field = sqlrows.db[tablename][fieldname]
#               except KeyError:
                except (KeyError,AttributeError):
                    field = None
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' rochacbruno 10/8/12 4:42 PM
Thanks, I will update the repo.
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' tomt 10/14/12 8:10 PM
I noticed another problem with powertable and web2py 2.0.9

When I created a new app under web2py 2.0.9 and tried to implement a powertable it exhibited some unusual behaviour. On initial callup, the powertable showed all records instead of the number specified by iDisplayLength and the columns don't show the column sorting icon. Also the column id is displayed even though table.showkeycolumn = False

Firebug showed an error in plugin_powertable/jquery.dataTables.min.js: "detailed error: TypeError: a.charCodeAt is not a function"

I discovered that if I replaced /static/js/jquery.js with version v1.7.1 from an earlier version of web2py, all the powertable problems disappeared.

Web2py 2.0.9 uses jQuery v@1.8.0 which apparently triggers the problem with powertable.  Earlier versions of web2py used jQuery v1.7.1 which seems to work ok with powertable.

I'm wondering if I can make powertable work if I use a more recent version of datatables?  Which files from the datatables would I have to incorporate? Any suggestions?

- Tom
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' tomt 10/17/12 9:06 PM
After a little digging around on the web  I found out why I was powertable was generating errors with the latest web2py.

jquery version 1.8 requires jquery-ui-1.8.22

I went to http://jqueryui.com/ and downloaded legacy v1.8.24 which provided jquery-ui-1.8.24.custom.zip. This zip file included
jquery-ui-1.8.24.custom.min.js which I then copied to static/plugin_powertable/ui/js
I modified models/powertable.py to load it:
response.files.append(URL(r=request,c='static',f='plugin_powertable/ui/css/%s/jquery-ui-1.8.24.custom.css' % theme))

After taking these steps, the error messages are gone and now powertable works with no problems.
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' palomar 11/23/12 11:44 AM
i think 
response.files.append(URL(r=request,c='static',f='plugin_powertable/ui/css/%s/jquery-ui-1.8.24.custom.js'))
;)

Il giorno giovedì 18 ottobre 2012 06:06:33 UTC+2, tomt ha scritto:
After a little digging around on the web  I found out why I was powertable was generating errors with the latest web2py.

jquery version 1.8 requires jquery-ui-1.8.22

I went to http://jqueryui.com/ and downloaded legacy v1.8.24 which provided jquery-ui-1.8.24.custom.zip. This zip file included
jquery-ui-1.8.24.custom.min.js which I then copied to static/plugin_powertable/ui/js
I modified models/powertable.py to load it:


After taking these steps, the error messages are gone and now powertable works with no problems.



On Sunday, October 14, 2012 9:10:17 PM UTC-6, tomt wrote:
I noticed another problem with powertable and web2py 2.0.9

When I created a new app under web2py 2.0.9 and tried to implement a powertable it exhibited some unusual behaviour. On initial callup, the powertable showed all records instead of the number specified by iDisplayLength and the columns don't show the column sorting icon. Also the column id is displayed even though table.showkeycolumn = False

Firebug showed an error in plugin_powertable/jquery.dataTables.min.js: "detailed error: TypeError: a.charCodeAt is not a function"

I discovered that if I replaced /static/js/jquery.js with version v1.7.1 from an earlier version of web2py, all the powertable problems disappeared.

Web2py 2.0.9 uses jQuery v@1.8.0 which apparently triggers the problem with powertable.  Earlier versions of web2py used jQuery v1.7.1 which seems to work ok with powertable.

I'm wondering if I can make powertable work if I use a more recent version of datatables?  Which files from the datatables would I have to incorporate? Any suggestions?

- Tom




On Monday, October 8, 2012 5:42:46 PM UTC-6, rochacbruno wrote:
Thanks, I will update the repo.
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' palomar 11/23/12 11:50 AM
Thanks for your tips but I have one more problem:
in my model I use represent to view the title instead of the ID of a linked table:

#db.acquisti.id_p.represent=lambda id, row: db.prodotti[id].nomeb

that (I think) generate this error whit powertable:
(<lambda>() takes exactly 2 arguments (1 given))

line 286:
                elif field.represent:
r = field.represent(r)

Someone can help me?
ciao ;)
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' tomt 11/23/12 5:40 PM
I run into the same problem.  I don't have a solution other than removing the row from the represent statement when using powertable. 
example:
db.acquisti.id_p.represent=lambda id: db.prodotti[id].nomeb
or
db.task.designer.represent = lambda value: db.staff[value].name

The problem with this is that it will then generate an error if SQLFORM.grid is used to display the same table.
Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual' palomar 11/24/12 4:03 AM
so, with web2py 2.2.1 and powertable:

db.acquisti.id_p.represent=lambda id: db.prodotti[id].nomeb          #SQLFORM.grid: doesn't work;  powertable: works
db.acquisti.id_p.represent=lambda id, row: db.prodotti[id].nomeb   #SQLFORM.grid: work;  powertable: doesn't work

Massimo, aiutaci tu! ;)