Re: [dabo-users] Sorting in the grid

Author: Paul McNett

Posted: 2009-09-09 at 18:24:07

Ricardo Aráoz wrote:

> Hello again. I have this grid with 5 columns, works ok but when running

> the form if I click on the column headers (to sort it) I get the

> following exceptions (one click on every one of the 5 columns, so there

> are 5 exceptions). The grid has Sortable=True as do the columns. I just

> can't find out what I'm doing wrong.

> File "C:\Python25\lib\site-packages\dabo\dabo\db\dCursorMixin.py",

> line 555, i

> n __sortRows

> self.__unsortedRows.append(row[kf])

> KeyError: 'PKId'

You have biz.KeyField set to "PKId". Does that field exist in the table, with that

same case-sensitive capitalization? To find out, open a command window from your app

(Ctrl+D) and issue:

biz = self.getBizobj("<the_bizobj's_datasource>")

pkfields = [f[0] for f in self.DataStructure if f[2]]

print pkfields

print biz.KeyField

print biz.KeyField == pkfields[0]

Paul

©2009 Paul McNett