good question.....i don't know the answer to it, but i suspect there is a way in your oncreate method to determine which table just had a creation and do different actions based on that.
On Monday, November 5, 2012 11:41:17 PM UTC-8, vivek wrote: > > > Hi , > > So in this case how do I make sure it fires only when a new record > is created for the child table in this case "quotelines" . Suppose if I > have 2 different functions to be fired for the parent - oncreate and child > - oncreate? > > Regards, > Vivek > > > > On Monday, October 29, 2012 11:39:08 PM UTC+4, howesc wrote: >> >> something like: >> >> def myondelete(table, row_id): >> .... >> pass >> >> form = SQLFORM.smartgrid(..., ondelete=myondelete, ...) >> >> >> >> On Sunday, October 28, 2012 6:57:12 AM UTC-7, vivek wrote: >>> >>> So how would the new code be? I am a newbie a bit of direction needed! >>> >>> >>> >>> >>> On Sun, Oct 28, 2012 at 5:39 PM, Niphlod <[email protected]> wrote: >>> >>>> oncreate, ondelete, onupdate are callbacks to functions, not dicts.... >>>> >>>> >>>> On Sunday, October 28, 2012 12:26:39 PM UTC+1, vivek wrote: >>>>> >>>>> Hi, >>>>> >>>>> @auth.requires_login() >>>>> def index(): >>>>> response.view = 'Final/pricelist.html' >>>>> form = SQLFORM.smartgrid(db.sourcelis**t,linked_tables=[ >>>>> 'itemowner'],**deletable=dict(sourcelist=Fals**e,itemowner=True),editable >>>>> =dict(sourcelist=False**,itemowner=True), details=dict(sourcelist= >>>>> False,**itemowner=False),links = dict(project=[lambda row: A(SPAN( >>>>> _class='icol-find'),_**href=URL("sourcelist","**itemowner",args=[row. >>>>> id]))]),o**ncreate=dict(itemowner=[avgpri**ce]),ondelete=dict( >>>>> itemowner=[**'avgprice'])) >>>>> return dict(form=form) >>>>> >>>>> @auth.requires_login() >>>>> def avgprice(): >>>>> ....... >>>>> >>>>> The above is my code . "itemowner" is my child table. I have manually >>>>> tried running avgprice() from appadmin to make sure it works. There wasnt >>>>> an issue. I just need to get the smartgrid to trigger avgprice. >>>>> >>>>> Thanks! >>>>> >>>>> -- >>>> >>>> >>>> >>>> >>> >>> --

