dabo Commit
Revision 5517
Date: 2009-11-13 14:48:13 -0800 (Fri, 13 Nov 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5517
Changed:
U trunk/dabo/biz/dBizobj.py
U trunk/dabo/ui/uiwx/dGrid.py
Log:
Incrementally searching on a virtual field was taking over a minute for 50 rows
because of the row change callback firing during the building of the sortlist.
Added a flag to force no callback to occur, and searching virtual fields is
lightning fast again.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2009-11-13 22:28:20 UTC (rev 5516)
+++ trunk/dabo/biz/dBizobj.py 2009-11-13 22:48:13 UTC (rev 5517)
@@ -1467,7 +1467,7 @@
return None
- def getFieldVal(self, fld, row=None):
+ def getFieldVal(self, fld, row=None, _forceNoCallback=False):
"""Return the value of the specified field in the current or
specified row."""
cursor = self._CurrentCursor
oldRow = self.RowNumber
@@ -1476,13 +1476,16 @@
def changeRowNumCallback(row):
# dCursorMixin is requesting a rowchange, which we must
do here so that
# child bizobjs get requeried. This is especially
important (and only
- # currenty happens) for virtual fields, in case they
rely on values
+ # currently happens) for virtual fields, in case they
rely on values
# gotten from children.
self._moveToRowNum(row)
for ch in self.__children:
if ch.RowCount == 0:
ch.requery()
+ if _forceNoCallback:
+ changeRowNumCallback = None
+
if cursor is not None:
try:
ret = cursor.getFieldVal(fld, row,
_rowChangeCallback=changeRowNumCallback)
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2009-11-13 22:28:20 UTC (rev 5516)
+++ trunk/dabo/ui/uiwx/dGrid.py 2009-11-13 22:48:13 UTC (rev 5517)
@@ -2727,7 +2727,6 @@
self.raiseEvent(dEvents.GridAfterSort, eventObject=self,
eventData=eventData)
-
def runIncSearch(self):
""" Run the incremental search."""
gridCol = self.CurrentColumn
@@ -2743,7 +2742,6 @@
return
newRow = self.CurrentRow
biz = self.getBizobj()
- ds = self.DataSet
srchVal = origSrchStr = self.currSearchStr
self.currSearchStr = ""
near = self.searchNearest
@@ -2753,9 +2751,9 @@
sortList = []
for i in range(0, self.RowCount):
if biz:
- val = biz.getFieldVal(fld, i)
+ val = biz.getFieldVal(fld, i,
_forceNoCallback=True)
else:
- val = ds[i][fld]
+ val = self.DataSet[i][fld]
sortList.append( [val, i] )
# Determine if we are seeking string values
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]