I have an SUComponent subclass whose domain object contains a list of
Things. The SUComponent contains a list of other subcomponents in an OrderedCollection instance variable #subViews, each subcomponent on 1 Thing. Each subcomponent renders an InPlaceEditor. I want to use Ajax to add Things to the domain list and update the subcomponent list. Below is the #renderContentOn: for the SUComponent. renderContentOn: html html div: [ html div id: 'ID1'; with: [ self renderSummaryOn: html. " simply renders -- We Have <N> Things" self subViews do: [ : sv | html render: sv ] " renders an InPlaceEditor on each Thing; works until '++' below". ]. html anchor onClick: ( html ajax id: 'ID1'; callback: [ :renderer | | newThing | newThing := self model addThing: 'a new one'. subViews add: (SubView new thing: newThing). self renderSummaryOn: renderer. self subViews do: [ :sv | renderer render: sv ] ] ); with: '++'. ]. Almost works, except that after pressing the '++': (a) the last added Thing does not have the snippet of Javascript code that the others do: Ajax.InPlaceEditor('id15','http://localhost:8080/seaside/dental',{callback:function(){return ['_s=xzNubmhAYkkRhziT','_k=Mbyouyhq','13','14='+escape(arguments[1])].join('&')},cancelText:'cancel'})} (b) the InPlaceEditors of the preceding Things no longer work. What am I doing wrong? Thanks in advance! _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> (a) the last added Thing does not have the snippet of Javascript code that
> the others do: > Ajax.InPlaceEditor('id15','http://localhost:8080/seaside/dental',{callback:function(){return > ['_s=xzNubmhAYkkRhziT','_k=Mbyouyhq','13','14='+escape(arguments[1])].join('&')},cancelText:'cancel'})} > > (b) the InPlaceEditors of the preceding Things no longer work. > > What am I doing wrong? What version of Scriptaculous are you using? If I remember correctly (I am still on holidays, so I don't have a Squeak image to check) the first versions of Scriptaculous did not evaluate the onLoad actions of the session for ajax-updates. I assume that you are correctly returning the sub-views as children of your component? Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
From: "Lukas Renggli" <[hidden email]> > What version of Scriptaculous are you using? I am now up to the latest version from Monticello, could not get it to work right. I have reverted to non-Ajax for appending elements to my collections of sub-components for now, but will gladly switch back if I learn how to do it right. > I assume that you are correctly returning the sub-views as children of > your component? I think so. No other errors reported. Thanks! _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> > What version of Scriptaculous are you using?
> > I am now up to the latest version from Monticello, could not get it to work > right. I have reverted to non-Ajax for appending elements to my collections > of sub-components for now, but will gladly switch back if I learn how to do > it right. Maybe you could post a minimal example of the code showing your problem, so that the community could reproduce and provide a fix either to scriptaculous or your code? Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
From: "Lukas Renggli" <[hidden email]>
> Maybe you could post a minimal example of the code showing your > problem, so that the community could reproduce and provide a fix > either to scriptaculous or your code? The attached shows the problem. Thanks! SUComponent subclass: #House instanceVariableNames: 'rooms' classVariableNames: '' poolDictionaries: '' category: 'MAp-House'! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:40'! children ^ self rooms! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:18'! initialize self rooms: OrderedCollection new.! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:37'! renderContentOn: html html div: 'a house'. self renderRoomsOn: html. html anchor onClick: ( html ajax id: 'theRooms'; callback: [ :renderer | self rooms add: (Room new). self renderRoomsOn: renderer ] ) ; with: '++'.! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:32'! renderRoomsOn: html html div id: 'theRooms'; with: [ self rooms do: [:room | html render: room]. ]. ! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'! rooms "Answer the value of rooms" ^ rooms! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'! rooms: anObject "Set the value of rooms" rooms _ anObject! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! House class instanceVariableNames: ''! !House class methodsFor: 'as yet unclassified' stamp: 'dd 7/31/2006 12:13'! canBeRoot ^ true! ! !House class methodsFor: 'as yet unclassified' stamp: 'dd 7/31/2006 12:15'! initialize (self registerAsApplication: 'house') libraries add: SUScriptLibrary! ! SUComponent subclass: #Room instanceVariableNames: 'name' classVariableNames: '' poolDictionaries: '' category: 'MAp-House'! !Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:13'! initialize self name: 'a room'! ! !Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:12'! name ^ name! ! !Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'! name: anObject "Set the value of name" name _ anObject! ! !Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 13:09'! renderContentOn: html html paragraph script: (html inPlaceEditor callback: [ :value :renderer | self name: value. renderer render: value , ' yup' ]; cancelText: ''); with: self name , ' yup'.! ! House initialize! _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Just to clarify: my code allows to add rooms to a house, or edit the name of
an existing room on a re-loaded page. But unless I do a page re-load, when I add a Room to a House with Ajax, all previously working Ajax components on that page stop working. ----- Original Message ----- From: "itsme213" <[hidden email]> > The attached shows the problem. Thanks! > > SUComponent subclass: #House > .... > .... _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Sophie424
Could someone help me understand why the code below shows the ajax inline
editors fine until I do an add operations, and then requires a page reload to resume working right? I've tried many things with no luck. Many thanks! SUComponent subclass: #House instanceVariableNames: 'rooms' classVariableNames: '' poolDictionaries: '' category: 'MAp-House'! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:40'! children ^ self rooms! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:18'! initialize self rooms: OrderedCollection new.! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:37'! renderContentOn: html html div: 'a house'. self renderRoomsOn: html. html anchor onClick: ( html ajax id: 'theRooms'; callback: [ :renderer | self rooms add: (Room new). self renderRoomsOn: renderer ] ) ; with: '++'.! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:32'! renderRoomsOn: html html div id: 'theRooms'; with: [ self rooms do: [:room | html render: room]. ]. ! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'! rooms "Answer the value of rooms" ^ rooms! ! !House methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'! rooms: anObject "Set the value of rooms" rooms _ anObject! ! "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! House class instanceVariableNames: ''! !House class methodsFor: 'as yet unclassified' stamp: 'dd 7/31/2006 12:13'! canBeRoot ^ true! ! !House class methodsFor: 'as yet unclassified' stamp: 'dd 7/31/2006 12:15'! initialize (self registerAsApplication: 'house') libraries add: SUScriptLibrary! ! SUComponent subclass: #Room instanceVariableNames: 'name' classVariableNames: '' poolDictionaries: '' category: 'MAp-House'! !Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:13'! initialize self name: 'a room'! ! !Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:12'! name ^ name! ! !Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 12:11'! name: anObject "Set the value of name" name _ anObject! ! !Room methodsFor: 'accessing' stamp: 'dd 7/31/2006 13:09'! renderContentOn: html html paragraph script: (html inPlaceEditor callback: [ :value :renderer | self name: value. renderer render: value , ' yup' ]; cancelText: ''); with: self name , ' yup'.! ! House initialize! _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Sophie424
> Just to clarify: my code allows to add rooms to a house, or edit the name of
> an existing room on a re-loaded page. > > But unless I do a page re-load, when I add a Room to a House with Ajax, all > previously working Ajax components on that page stop working. What Monticello version of script.aculo.us are you using? It doesn't work with the latest one. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Looks like I was on lr.70.mcz. That version had SUInPlaceEditor. I just
tried to update to lr.123.mcz and could not find SUInPlaceEditor or any obvious replacement. What would be the nearest approximation for inplace editing? Thanks. ----- Original Message ----- From: "Lukas Renggli" <[hidden email]> To: "The Squeak Enterprise Aubergines Server - general discussion." <[hidden email]> Sent: Friday, August 04, 2006 1:25 AM Subject: Re: Re: Re: [Seaside] Appending to list of modelobjects&updating(sub)component list with scriptaculous / A >> Just to clarify: my code allows to add rooms to a house, or edit the name >> of >> an existing room on a re-loaded page. >> >> But unless I do a page re-load, when I add a Room to a House with Ajax, >> all >> previously working Ajax components on that page stop working. > > What Monticello version of script.aculo.us are you using? It doesn't > work with the latest one. > > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I wondered about the same thing. At some point the in-place editor just
disappeared for some reason, I want it back too! ;) Cheers! -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 [hidden email] CONFIDENTIALITY NOTICE This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments. Thank you. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of itsme213 Sent: Friday, August 04, 2006 2:57 PM To: The Squeak Enterprise Aubergines Server - general discussion. Subject: Re: Re: Re: [Seaside] Appending to list ofmodelobjects&updating(sub)component list with scriptaculous / A Looks like I was on lr.70.mcz. That version had SUInPlaceEditor. I just tried to update to lr.123.mcz and could not find SUInPlaceEditor or any obvious replacement. What would be the nearest approximation for inplace editing? Thanks. ----- Original Message ----- From: "Lukas Renggli" <[hidden email]> To: "The Squeak Enterprise Aubergines Server - general discussion." <[hidden email]> Sent: Friday, August 04, 2006 1:25 AM Subject: Re: Re: Re: [Seaside] Appending to list of modelobjects&updating(sub)component list with scriptaculous / A >> Just to clarify: my code allows to add rooms to a house, or edit the name >> of >> an existing room on a re-loaded page. >> >> But unless I do a page re-load, when I add a Room to a House with Ajax, >> all >> previously working Ajax components on that page stop working. > > What Monticello version of script.aculo.us are you using? It doesn't > work with the latest one. > > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside smime.p7s (4K) Download Attachment |
In reply to this post by Sophie424
>>> Just to clarify: my code allows to add rooms to a house, or edit the name
>>> of an existing room on a re-loaded page. >>> But unless I do a page re-load, when I add a Room to a House with Ajax, >>> all previously working Ajax components on that page stop working. Scripts in AJAX update actions do not get evaluated, unless you tell script.aculo.us to do so. This means in you need to add to your ajax-update action "evalScripts: true" and the behavior will persist. I attached a change-set that fixes this problem and that patches two other methods to make it work with the latest version of Seaside and script.aculo.us. Have fun! Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside MapHouseFix.1.cs (1K) Download Attachment |
Thanks so much for your help, Lukas. I'm sure I will have more questions :-)
> Scripts in AJAX update actions do not get evaluated, unless you tell > script.aculo.us to do so. This means in you need to add to your > ajax-update action "evalScripts: true" and the behavior will persist. > > I attached a change-set that fixes this problem and that patches two > other methods to make it work with the latest version of Seaside and > script.aculo.us. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |