I may be reinventing the wheel here, but I could find no method in dGrid to 
find the column index for a column by using its DataField name. 
getColByDataField() returns a column name but no index value. The problem lies 
in using setValue() where a row and column index are needed. To get around this 
I modified getColByDataField():

def getColByDataField(self, df,index = False):
                """ Given a DataField value, return the corresponding column."""
                try:
                        col = [(idx,self.Columns[idx]) for idx in 
range(len(self.Columns))if 
                                self.Columns[idx].DataField == df][0]
                        if index == False:
                                ret = col[1]
                        else:
                                ret = col
                        #ret = [col for col in self.Columns
                        #               if col.DataField == df][0]
                except IndexError:
                        ret = None
                return ret

The default behavior is to return the same information as in the original 
function. If index = True then a tuple is returned with the index and column. I 
don't know if this is useful or not. If not I will create a private function to 
do this and leave the original alone.

--
Adrian Klaver
[EMAIL PROTECTED]


_______________________________________________
Post Messages to: [email protected]
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/[EMAIL PROTECTED]

Reply via email to