This is my first dabo form working with parent-child tables and I'm
having newbie trouble.
Parent is an Invoice table, child is an InvoiceItem table.
Followed the pycon tutorial and set the LinkField property and set
FillLinkFromParent to True in InvoiceItem.
In Invoice imported InvoiceItem biz class and as the tutorial suggests
(self is the Invoice bizobject) :
app = self.Application
self.InvoiceItem = InvoiceItem(app.dbConnection)
self.addChild(self.InvoiceItem)
In my form I have a grid with DataSource = 'InvoiceItem', and in the
form's addItem() method I do:
bizInv = self.getBizobj()
bizInvoiceItem = bizInv.InvoiceItem
bizInvoiceItem.new()
But the grid showed no new records. Used the command window and found
out that the records are added to bizInv.InvoiceItem and that this
Bizobject is a different Bizobject than plain
self.getBizobj('InvoiceItem') . As my grid is linked to InvoiceItem it
does not see the new records that are being effectively added to
bizInv.InvoiceItem bizobject.
The obvious solution would be to modify the form's addItem() method to:
bizInv = self.getBizobj()
bizInvoiceItem = self.getBizobj('InvoiceItem')
bizInvoiceItem.new()
Which will add records to the InvoiceItem bizobject.
A second approach would be to set the DataSource of the grid to the
Invoice.InvoiceItem bizobject.
My doubts are :
- is there a better way?
- Approach 1
- if I will use InvoiceItem directly. Do I need to create
Invoice.InvoiceItem?
- will the FillLinkFromParent still work?
-Approach 2
- how do I tell the grid's DataSource about Invoice.Invoiceitem
setting grid.DataSource = 'Invoice.InvoiceItem' does seem a little far
fetched but I would love to go this way.
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]