I posted these notes I made regarding defects in the FlexiGrid widget
documentation at
http://docs.turbogears.org/2.0/RoughDocs/ToscaWidgets/Cookbook/FlexiGrid
in the turbogears-docs google group, but they never showed up, so I'm
posting them again here:

I know these are labeled "RoughDocs" and I gather are not officially
maintained by anybody, but if these notes of mine can save anyone the
hours that I wasted figuring this stuff out, it's worth my while to
share them here and hopefully someone could make the appropriate
updates to the wiki:

First of all, it says

*"searchItems* List of columns to be displayed in the drop down list
for searching matching records. This is a list of dictionaries
containing the attribute name and the display name. This example shows
a list of searchitems:"

The correct spelling of the key word argument is "searchitems", all
lower case, not camel-case. Spelling it wrong will not elicit any
errors, you will just be left wondering why the search button is
mysteriously missing.

Secondly, it says:
"

   *

     *buttons* A list of buttons that should appear on the table
     header. Each button is provided as a dictionary. For example:

     buttons=[
       {'name':'Add', 'bclass':'add', 'onpress': 'add'},
       {'name':'Delete', 'bclass':'delete', 'onpress': 'delete'},
       {'separator':True}
     ]

The onpress key takes a javascript callback function as value which is
called when the button is pressed. In this example, the Add button
triggers the callback function add()"

This will also not work. And once again, you will be left wondering
why your javascript callback function mysteriously never gets called.
In the Venkman debugger, for example, you will see an error like
"this.onpress: not a function". You need to pass a js_callback for the
value corresponding to the 'onpress' key in the buttons dictionary.
Otherwise,  javascript will see here a plain old string 'add' (ie, not
a function!). Here's a fix:

from tw.api import js_callback

mycallback = js_callback("add")
buttons=[
 {'name':'Add', 'bclass':'add', 'onpress': mycallback},...]





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to