Is this the right way to insert an X into a list of X's (for the cases where
static html ids will work)? XComponent>> renderXInserterOn: html ^ html anchor onClick: (html updater id: 'xList' ; insertion: SUInsertion bottom ; "or top, above, below" on: #addXAndRenderOn: of: self) ; with: 'add X' XComponent>> addXAndRenderOn: r on: selector of: obj "make change by adding one X to domain model, re-paint just the new X" Is there an SU equivalent to remove, hide, and show an element? Thanks, Sophie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
"itsme213" <[hidden email]> wrote in message news:fj9aos$u5u$[hidden email]... > XComponent>> > addXAndRenderOn: r on: selector of: obj > "make change by adding one X to domain model, re-paint just the new X" In particular, this appears to work but feels very unclean - combining domain model change with UI change. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Sophie424
> Is this the right way to insert an X into a list of X's (for the cases where
> static html ids will work)? It depends what you want to do. SUElement has many other cool methods to change your DOM elements. > Is there an SU equivalent to remove, hide, and show an element? The methods are called #remove, #hide and #show. Have a look at SUElement and at the Prototype API http://www.prototypejs.org/api/element. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Sophie424
> > XComponent>>
> > addXAndRenderOn: r on: selector of: obj > > "make change by adding one X to domain model, re-paint just the new X" > > In particular, this appears to work but feels very unclean - combining > domain model change with UI change. If you package it properly, I don't see a problem. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
>> > XComponent>>
>> > addXAndRenderOn: r on: selector of: obj >> > "make change by adding one X to domain model, re-paint just the new X" >> >> In particular, this appears to work but feels very unclean - combining >> domain model change with UI change. > I don't know 100% what you are doing, but here are some ideas: If you want to abstract things a little bit, you could always do something like raise an event that another class is listening for. This is generally what I did when I used MVP in other languages, albeit I don't do that in seaside so far. For example, user clicks a button to add an X. From the view class, I might raise an add event with x as the data in the event args. The presenter would update the model with the data from the event without any knowledge of how the view was dealing with the x. Meanwhile, I could raise an event back to the view to update itself, or depending on whether or not you are using passive MVP, I could call a method instead. The observer pattern can also be used in these situations. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Lukas Renggli
"Lukas Renggli" <[hidden email]> wrote in message
>> Is this the right way to insert an X into a list of X's (for the cases >> where >> static html ids will work)? > > It depends what you want to do. SUElement has many other cool methods > to change your DOM elements. > >> Is there an SU equivalent to remove, hide, and show an element? > > The methods are called #remove, #hide and #show. Sorry to be a pain, but I was not able to figure out how to use them. I tried html anchor onClick: (html updater id: 'idToRemove' ; insertion: SUElement new remove ; callback: [ ]) ; with: 'del.' But this does not remove the 'idToRemove' element. Thanks - Sophie _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> Sorry to be a pain, but I was not able to figure out how to use them. I
> tried > html anchor > onClick: (html updater > id: 'idToRemove' ; > insertion: SUElement new remove ; > callback: [ ]) ; > with: 'del.' No updater is needed in this example. Just use: html anchor onClick: (html element id: 'idToRemove'; remove); with: 'del' Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |