4 ms·
Writing an observer class in easy, Managing the state of hundreds of them is not. Now what if the user can change the cat's name by clicking on it and editing
by camus2 13y ago
Writing an observer class in easy, Managing the state of hundreds of them is not.
Now what if the user can change the cat's name by clicking on it and editing the div content,but cant give a cat a name already taken, because this cat is part of a collection of cats on that web page, which have the same editing features as Gary? Of course, cats are sorted and any change to one cat updates the sort order.
Suddenly your 39 line framework becomes worthless.
- Kequc 13y agoI am presuming that the application stores its state server side, if that is the case than this is not at all useless. Presumably you are sending the edited name to the server the server sends back the result of the edit. If the result of the edit was that the name was unavailable and therefore remains unchanged then this won't do anything: gary.update.all jsonResult Even if you aren't storing state server-side. In the update attr methods have name changing check the rest of your cats for an existing name.