Thanks a lot Randal and Tom,<br>I could accomplish the task with your help and guidance.<br>The following are the things I did.<br><br>1) Add 'identifier' an instance Variable in MySession (which is my root session class).
<br><br>2) Add 2 methods #identifier and #identifier: in MyRootComponent ( Which is a subclass of WAComponent and my root component)<br><br>MyRootComponent>> identifier<br>^ self session identifier<br><br><br>MyRootComponent>>identifier: anId
<br>self session identifier: anId<br><br><br>3) Override #updateUrl: in MyRootComponent<br><br>updateUrl: url<br>"identifier has the html Id of the anchor/element clicked last"<br> super updateUrl: url.<br>
url fragment: self identifier<br><br>4)MyRootComponent # renderContentOn: is simple<br><br>MyRootComponent>>renderContentOn: html<br>"model is an OrderedCollection"<br>self model do: [:eachItem | self renderEachItem: eachItem on: html]
<br><br><br>5) #renderEachItem:on: is tweaked a bit to accomodate html anchor name: . I suppose this can also work with textInputs and submitButtons or any other form elements.<br><br><br>MyRootComponent>>renderEachItem: eachItem on: html
<br><br>"I am going to have some temp variables to assign html nextId. Each Item has title, quantity"<br>| id1 id2 id3 |<br>id1 := id2 := id3 := nil.<br>html text: anItem title.<br>html text: anItem quantity.<br>
html anchor name: (id1 := html nextId); callback: [self identifier: id1.self incrementQuantity: anItem]; with: '+'.<br>html anchor name: (id2 := html nextId); callback: [self identifier: id2.self decrementQuantity: anItem]; with: '-'.
<br>html anchor name: (id3 := html nextId); callback: [self identifier: id3.self delete: anItem]; with: 'Delete'.<br><br><br><br>Thanks a lot again to all the experienced users who make our lives easier. What a way to start a New Year.
<br><br><br>Thanks & Regards,<br>Rajeev<br><br><br><div class="gmail_quote">On Jan 1, 2008 10:51 PM, Randal L. Schwartz <<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
>>>>> "Rajeev" == Rajeev Lochan <<a href="mailto:lochan94@gmail.com">lochan94@gmail.com</a>> writes:<br><br>Rajeev> I tried this and it works out of the box only with a particular predefined
<br>Rajeev> Anchor. As I mentioned above, mine is going to be Dynamically built list<br>Rajeev> with a lot of items. Is there anyway to assign unique name to all anchors.<br>Rajeev> One of the solutions I can think of is
<br><br>Rajeev> html anchor name: html nextId asString.<br><br>Rajeev> Then somehow pass this information to #updateUrl:<br><br>Just designing out loud, but I suspect your callback could update a state<br>variable (in the component) that defines the anchor tag to which to scroll,
<br>and the #updateUrl: of that component would add that tag to the url. Might<br>just work, since the callback pass is processed *before* the rendering pass.<br><font color="#888888"><br>--<br>Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<br><<a href="mailto:merlyn@stonehenge.com">merlyn@stonehenge.com</a>> <URL:<a href="http://www.stonehenge.com/merlyn/" target="_blank">http://www.stonehenge.com/merlyn/</a>><br>Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
<br>See <a href="http://PerlTraining.Stonehenge.com" target="_blank">PerlTraining.Stonehenge.com</a> for onsite and open-enrollment Perl training!<br></font></blockquote></div><br><br clear="all"><br>-- <br>Rajeev Lochan<br>
<br>Co-founder, AR-CAD.com<br><br><a href="http://www.ar-cad.com">http://www.ar-cad.com</a><br>+91 9243468076 (Bangalore)<br>080 65355873