Urrghh Why not keep an array of selected rows in your UI component and then use that to decide re: CSS
Mark -- Dr. Mark Wardle Specialist registrar, Neurology (Sent from my mobile) On 29 Mar 2011, at 17:09, Theodore Petrosky <[email protected]> wrote: > okay, let me tell you what I want to accomplish. > > I have a table of 100 rows. I want the user to select an arbitrary group of > rows and change the background color. > > So I thought I would add a boolean setter and getter to the entity: > > public void setIsSelectedForEdit(boolean _isSelectedForEdit) { > NSLog.out.appendln("setIsSelectedForEdit in the object = " + > _isSelectedForEdit); > this._isSelectedForEdit = _isSelectedForEdit; > } > > public boolean isSelectedForEdit() { > return _isSelectedForEdit; > } > > then if the users checks the checkbox in an arbitrary group I could know > which are selected and update the CSS. (I also have an AjaxObserveField > watching the checkBox and the whole thing is wrapped in an updateContainer) > > it works, sort of. the attribute _isSelectedForEdit is getting set but the > Entity doesn't know it was changed. I don't care about saving this boolean > value, I just need to know which rows to color (I will save THIS value). > > That's when I decided to try a 'Real' attribute. > > <td> > <wo:WOCheckBox checked = "$theGridItem.globalUpdate" id = > "$session.rowID"/><webobject name = "SelectedForEditObserveField"/> > </td> > > globalUpdate is a real boolean attribute of my Grid object. > > if I bind this attribute to the checkBox, all the objects are marked as > updated. > > so on a lark (or maybe it was a bluejay) I switched back to my original > setter with a nod to the real attribute: > > public void setIsSelectedForEdit(boolean _isSelectedForEdit) { > NSLog.out.appendln("setIsSelectedForEdit in the object = " + > _isSelectedForEdit); > this._isSelectedForEdit = _isSelectedForEdit; > > /* let the value be false > * as I don't really care about this value > */ > > this.takeValueForKey(false, _Grid.GLOBAL_UPDATE); > } > > This works as I want. the row get marked to update, the real value never > changes (I can throw it away) and > > NSLog.out.appendln("checkAlteredAction == " + theEC.updatedObjects()); > > only lists the rows that are selected (checked) as altered. > > I don't want to say that there must be a better way. But if it works and > doesn't blow up then it is good, right? > > There is just too much to learn for one lifetime. > > Ted > > > > > > --- On Tue, 3/29/11, Chuck Hill <[email protected]> wrote: > >> From: Chuck Hill <[email protected]> >> Subject: Re: changed objects >> To: "Theodore Petrosky" <[email protected]> >> Cc: "David Avendasora" <[email protected]>, >> [email protected] >> Date: Tuesday, March 29, 2011, 11:23 AM >> >> On Mar 29, 2011, at 5:49 AM, Theodore Petrosky wrote: >> >>> I find that i have a boolean that is bound to the >> 'checked' of my WOCheckBox: >>> >>> wo:WOCheckBox checked = "$theGridItem.globalUpdate" / >>> >>> Originally I thought it was because I had an >> AjaxObserveField to watch the checkbox, so I deleted it. No >> Joy. so as long as the WOCheckBox is there, I have this >> issue. theEC.updatedObjects() believes that all the entities >> have been updated. >>> >>> The globalUpdate attribute is a boolean (intBoolean) >> in my postgresql backend. >>> >>> Am I screwing this up? >> >> Probably. :-) You could override the setter and >> log out the original and new value and see if that shows >> anything. An object being in the updated list just >> indicates that it _may_ have changed. So either the value is >> getting changed, or WOCheckBox is needlessly setting the >> Boolean to the exact same value. >> >> >> Chuck >> >> >>> --- On Mon, 3/28/11, David Avendasora <[email protected]> >> wrote: >>> >>>> From: David Avendasora <[email protected]> >>>> Subject: Re: changed objects >>>> To: "Chuck Hill" <[email protected]> >>>> Cc: "Theodore Petrosky" <[email protected]>, >> [email protected] >>>> Date: Monday, March 28, 2011, 4:31 PM >>>> Or, I believe, an MS SQL Server DB >>>> with Date columns as locking attributes... >>>> >>>> Dave >>>> >>>> On Mar 28, 2011, at 2:26 PM, Chuck Hill wrote: >>>> >>>>> If all the objects are in that list, then all >> have >>>> been changed. You might have a floating >> point value >>>> that is getting altered due to a formatter (e.g. >> the scale >>>> is different). >>>>> >>>>> Chuck >>>>> >>>>> >>>>> On Mar 28, 2011, at 11:16 AM, Theodore >> Petrosky >>>> wrote: >>>>> >>>>>> OK I thought I did this before but I can >> not think >>>> of how I did it. >>>>>> >>>>>> I have an EC made with: theEC = >>>> ERXEC.newEditingContext(); >>>>>> >>>>>> I then get a list and use a displayGroup >> to >>>> display it in a table. I want to make a few edits, >> then ask >>>> the EC for the changed objects. >>>>>> >>>>>> NSLog.out.appendln("checkAltered >>>> == " + theEC.updatedObjects()); >>>>>> >>>>>> updatedOjbects returns all the objects in >> the >>>> array. I just want the ones that were altered. Is >> there a >>>> way? >>>>>> >>>>>> Ted >>>>> >>>>> -- >>>>> Chuck Hill >> >>>> Senior Consultant / VP Development >>>>> >>>>> Practical WebObjects - for developers who want >> to >>>> increase their overall knowledge of WebObjects or >> who are >>>> trying to solve specific problems. >>>>> http://www.global-village.net/products/practical_webobjects >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >> _______________________________________________ >>>>> Do not post admin requests to the list. They >> will be >>>> ignored. >>>>> Webobjects-dev mailing list >> ([email protected]) >>>>> Help/Unsubscribe/Update your Subscription: >>>>> http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com >>>>> >>>>> This email sent to [email protected] >>>> >>>> >> >> -- >> Chuck Hill >> Senior Consultant / VP Development >> >> Practical WebObjects - for developers who want to increase >> their overall knowledge of WebObjects or who are trying to >> solve specific problems. >> http://www.global-village.net/products/practical_webobjects >> >> >> >> >> >> >> >> > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list ([email protected]) > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/webobjects-dev/mark%40wardle.org > > This email sent to [email protected] _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
