Hi:
I'm using the PaginateDataGrid widget (SQLObject/Kid) and have modified
my template to add a couple options that I can pass to the columns.
1. align - sets the column alignment
2. suppressRepeating - tells the column to suppress repeating values
This is all working fine, most of the time. The only problem I am
seeing is that if I filter the selectresults object before handing it
off to the template, my suppressRepeating values suppresses, but doesn't
show the value when it is supposed to. I'm thinking that problem is
that I don't understand when the filter is run on the selectresults or
how the datagrid widget is filtering out the records to include.
The relevant controller code is:
# Get the initial data
railStatus = RailStatusView.select(IN(RailStatusView.q.railCarID,
[rcc.railCarId for rcc in
RailCategoryCar.select('railCategoryId=%s' % (railCategoryId))]),
orderBy=['railCarName',
'-dateOfStatus'])
# Get the parameters that were passed in
searchText = qlfUtil.getStringFilterValue(kw, 'searchText',
'railStatusSearchText')
# Apply the filters
if searchText != '' and searchText != None and searchText != 'None':
railStatus =
railStatus.filter(OR(RailStatusView.q.railCarName.contains(searchText),
RailStatusView.q.destinationCity.contains(searchText)))
railStatus gets passed to the template as 'value'...
...and the relevant template code is:
<tr py:for="i, row in enumerate(value)" class="${i%2 and
'odd' or 'even'}">
<td py:for="col in columns"
align="${col.get_option('align', 'left')}">
----> <span
py:if="col.get_field(value[i-1])==col.get_field(row) and
col.get_option('suppressRepeating', False)"> </span>
----> <span
py:if="col.get_field(value[i-1])!=col.get_field(row) or not
col.get_option('suppressRepeating', False)">${col.get_field(row)}</span>
</td>
</tr>
Can anyone shed some light on why this isn't working for me when I pass
something in the searchText field to the controller? Or, is there some
reading I could do somewhere about the widget/template rendering and
when it all takes place? This one really surprised me and makes me
think I'm missing something in how this all works together.
-Jim
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---