Re: How to delete an EO?
Re: How to delete an EO?
- Subject: Re: How to delete an EO?
- From: Bill Reynolds <email@hidden>
- Date: Sat, 17 Apr 2004 11:55:05 -0700
I found the 'glitch'. I was calling the function from a button bound within
a JSConfirmPanel. Because a new page returned each time I tested it I was
misled to believe that the proper function was being called. As soon as I
bound the same function to a hyperlink it began working. I can't say I
understand why a Hyperlink vs. WOSubmit button differs behavior when bound
to the same function - but it does. Now I feel really dumb for having
asked.
> From: "Glenn L. Austin" <email@hidden>
> Date: Sat, 17 Apr 2004 09:28:17 -0700
> To: <email@hidden>
> Subject: Re: How to delete an EO?
>
> on 4/17/04 8:47 AM, Chuck Hill at email@hidden wrote:
>
>> public WOComponent deleteRecord()
>> {
>> userRecord().editingContext().deleteObject(userRecord());
>> userRecord().editingContext().saveChanges();
>> return null;
>> }
>>
>> Looks correct to me. Are you getting an exception or error message?
>> What happens? If you are not seeing an exception or error then
>> something someplace else is wrong.
>
> I see a potential problem. I would code it like this:
>
> public WOComponent deleteRecord()
> {
> EOEditingContext context = userRecord().editingContext();
>
> context.deleteObject(userRecord());
> context.saveChanges();
>
> return null;
> }
>
> That way, if the context happens to change due to the deleteObject, the
> saveChanges() will continue to work.
>
> --
> Glenn L. Austin <><
> Computer Wizard and Race Car Driver
> <email@hidden>
> <http://www.austin-home.com/glenn/>
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.