true. fields should also work with expressions
db.table.field1*db.table.field2+1 although I did not try.

On Nov 14, 3:36 pm, JaapP <[email protected]> wrote:
> One more reason to stick to using fields could be that with fields you
> can specify the order in which the columns are shown, this didn't work
> for 'columns'
>
> On 14 nov, 18:13, Jim Steil <[email protected]> wrote:
>
>
>
>
>
>
>
> > Ok, columns are gone again...
>
> > Might just be best to stick with using fields.
>
> >      -Jim
>
> > On 11/14/2011 8:47 AM, Jim Steil wrote:
>
> > > I stand corrected on the 'columns' comment.  Massimo added it back in
> > > this morning.
>
> > >     -Jim
>
> > > On 11/14/2011 8:45 AM, Jim Steil wrote:
> > >> here are a few thoughts...
>
> > >> 1.  Make sure you create this test in a new app.  If you're updating
> > >> or adding functionality to an already existing app, then your layout
> > >> and base.css need to be updated.
> > >> 2.  If using jquery-ui, then you need to download jquery-ui and
> > >> include it in your layout.html with a line like this:
>
> > >> {{response.files.append(URL('static','jquery-ui/js/jquery-ui-1.8.16.custom.
> > >>  min.js'))}}
>
> > >> {{response.files.append(URL('static','jquery-ui/css/sunny/jquery-ui-1.8.16.
> > >>  custom.css'))}}
>
> > >> 3.  Don't use the 'columns' argument.  It is going away in the next
> > >> release.  Instead, use 'fields'.  In your case, use the following:
>
> > >> fields = [db.projects_posts.title, db.projects_posts.project_details,
> > >> db.projects_posts.estimated_worth]
>
> > >> 4.  I typically do not specify the 'headers' arg.  Instead, set the
> > >> 'label' on your table definition.  That way you only have to do it
> > >> once and can use it all over.  If you need to override it for a
> > >> particular function, then just set the 'label' attribute in that
> > >> function.
>
> > >> 5.  At this time there is no documentation available for SQLFORM.grid
> > >> or SQLFORM.smartgrid.  The best thing to do would be to look through
> > >> this group for all the posts.  Massimo is working on an updated
> > >> version of that manual that he is hoping to have complete by the end
> > >> of this month.  That should contain information on .grid and .smartgrid.
>
> > >> 6.  If you are going to be playing around with this I would recommend
> > >> that you work with the code in trunk.  I don't recall what state the
> > >> .grid was in when 1.99.2 was released.
>
> > >> As for answers for your specific questions:
>
> > >> Q: What is the exact proper method to use SQLForm.grid -
> > >> I think your on the right track.  Just need to clean up your css and
> > >> layout.html files to get the proper formatting.
>
> > >> Q: What all libraries do I need to include? where?
> > >> If you want to use jquery-ui then you need to download it and
> > >> reference it in your layout.html.
>
> > >> Q: How to make links work the way they should ?
> > >> I'd like some more information on what is going on here before giving
> > >> an answer.
>
> > >> Q: Can search be customized? How?
> > >> I don't remember if the search_form is implemented in 1.99.2, but
> > >> there is a search facility built in that allows the users to create a
> > >> custom search.  I am not a fan of it and have some other ideas how
> > >> developers could be allowed to create custom search forms, but I
> > >> haven't opened a ticket on it yet.
>
> > >> Q: Is this documented in online book?  - did not find much about it in
> > >> version 3.2 though.
>
> > >> Documentation will be coming with the next version of the book
> > >> targeted for the end of the month.
>
> > >> Hope this helps.
>
> > >>     -Jim
>
> > >> On 11/14/2011 6:54 AM, Rahul wrote:
> > >>> Hi All,
> > >>>        Can anyone let me know how to use SQLForm.grid properly or tell
> > >>> me what I am missing. I have not installed any jquery plugin for the
> > >>> same (assuming that it is part of 1.99.2 by default). I cannot see the
> > >>> complete grid, just some buttons and data as per my query below. Also
> > >>> the links do not function when clicked. The table does not show any
> > >>> backgroud color or anything. Simply it doesnt look like a jquery
> > >>> grid.  My code is as below -
>
> > >>> My machine - Windows7 , IE9 and Firefox 7.0, Chrome.
> > >>> Web2py- Latest stable (1.99.1)
>
> > >>> #---------Controller- (default.py)---
> > >>> def index():
> > >>>      """
> > >>>      example action using the internationalization operator T and flash
> > >>>      rendered by views/default/index.html or views/generic.html
> > >>>      """
> > >>>      #Posts grid - SQLForm.grid
> > >>>      #grid = SQLFORM.grid(db.projects_posts)
> > >>>      query = ((db.projects_posts.post_visibility=="Classified"))
> > >>>      columns = ('projects_posts.title',
> > >>>                 'projects_posts.project_details',
> > >>>                 'projects_posts.estimated_worth'
> > >>>                )
> > >>>      headers ={'projects_posts.title': 'Title',
> > >>>                'projects_posts.project_details': 'Details',
> > >>>                'projects_posts.estimated_worth': 'Worth'}
>
> > >>>      form = SQLFORM.grid( query=query, columns=columns,
> > >>> headers=headers,
> > >>>                           deletable=False, editable=False, csv=False,
> > >>> maxtextlength=64 )
>
> > >>>      return dict(form=form)
>
> > >>> #--------- View ---  (index.html)
> > >>> {{extend 'layout.html'}}
> > >>> {{=form}}
>
> > >>> Also, if possible please refer me to the proper documentation for
> > >>> SQLForm.grid. Again, if I include the parameter  form =
> > >>> SQLForm.grid(.....,  ui="jquery-ui") in above code, the buttons
> > >>> disappear and it only shows me links for 'view' etc.
>
> > >>> Q: What is the exact proper method to use SQLForm.grid -
> > >>> Q: What all libraries do I need to include? where?
> > >>> Q: How to make links work the way they should ?
> > >>> Q: Can search be customized? How?
> > >>> Q: Is this documented in online book?  - did not find much about it in
> > >>> version 3.2 though.
>
> > >>> Please advice or refer me to the proper thread(though I checked
> > >>> several to find solutions).
>
> > >>> Regards, Rahul

Reply via email to