On Wednesday 08 July 2009 04:46:20 pm Miguel Lopes wrote:
> I'm trying without success to have a grid with two checkboxes.
>
> The first checkbox (contactSelect) allows me to indicate which records
> to select. the second indicates if the record is to be shared
> (contactShare) (just something about the record).
> My problem is that most checkbox clicks somehow affect the other
> checkbox. This happens irrespectively of if I press contactSelect or
> contactShare, and even affects records in different rows.
>
> I can't seem to find a solution for this. Here's my bizobj code. Any ideas?
>
> class ContactBizobj(dabo.biz.dBizobj):
>       def afterInit(self):
>               self.addFrom("contact")
>               self.addField("contact.mobile")
>               self.addField("contact.phone_ext")
>               self.addField("contact.title_id")
>               self.addField("contact.phone")
>               self.addField("contact.contact")
>               self.addField("contact.contact_status_id")
>               self.addField("contact.contact_type_id")
>               self.addField("contact.email")
>               self.addField("contact.job_title")
>               self.addField("contact.contact_id")
>               self.addField("contact.account_id")
>
>               self.addJoin("account", "contact.account_id = 
> account.account_id",
> joinType="LEFT")
>               self.addField("account.account")
>
>               self.DataSource = "contact"
>               self.LinkField = "account_id"
>               self.KeyField = "contact_id"
>               self.NonUpdateFields=["contact_id"]
>               self.FillLinkFromParent = True
>
>               self.VirtualFields.update({'contactSelect': self.contactSelect,
>                                                                  
> 'contactShare': self.contactShare})
>
>       def contactSelect(self):
>               if self.Record.contact_id in self.__selectedContactsToAssign:
>                       # it's already selected, unselect
>                       del 
> self.__selectedContactsToAssign[self.Record.contact_id]
>                       return False
>               else:
>                       # not selected, select it - "False" means it is not 
> shared
>                       self.__selectedContactsToAssign[self.Record.contact_id] 
> = False
>                       return True
>
>       def contactShare(self):
>               if self.Record.contact_id in self.__selectedContactsToAssign 
> and \
>                 self.__selectedContactsToAssign[self.Record.contact_id] == 
> False:
>                       # not shared, share it - "True" means it is shared
>                       self.__selectedContactsToAssign[self.Record.contact_id] 
> = True
>                       return True
>               else:
>                       return False
>
>       def validateRecord(self):
>               """Returning anything other than an empty string from
>               this method will prevent the data from being saved.
>               """
>               ret = ""
>               # Add your business rules here.
>               return ret
>
>       def initProperties(self):
>               self.__selectedContactsToAssign={}
>
>
> TIA,
> Miguel

On the surface I don't see anything wrong with the bizobj.  What does the grid 
code look like?  In the grid you should be marking the fields as 'boolean'.  
I have just yesterday coded a grid with two check boxes and it appears to 
work OK.  However, my fields are not virtual fields.




_______________________________________________
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