Paul McNett wrote: > 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] > Second line raised : AttributeError: 'dForm_30698' object has no attribute 'DataStructure' So I swapped "biz" for "self". The results were : ------------------------------------------------ [] PKId Traceback (most recent call last): File "<input>", line 1, in <module> IndexError: list index out of range ------------------------------------------------ My bizobj : class OpMejoraBizobj(dabo.biz.dBizobj): def afterInit(self): self.DataSource = "OpMejora" self.KeyField = "PKId" self.addFrom("OpMejora") self.addField("Registro") self.addField("Revision") self.addField("FechaOrigen") etc....
My table : CREATE TABLE opmejora ( "PKId" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "Registro" INTEGER, "Revision" INTEGER, "FechaOrigen" TEXT, "FKSectorOrigen" INTEGER, "FKClasificacion" INTEGER, etc... So it would seem ok. Though it worries me the fact that I have not defined a DataStructure in the bizobj, I thought it was not necessary. --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/4aa83a69.1070...@gmail.com