Hello everyone,
I am trying out cola.js (tag 0.1.5) and I have a question or two.
Some background. As an excuse for practising some sane JavaScript Web Development I am playing on an idea for a children's application for learning languages. It is something I am trying out in my limited spare time. For now I am working on a page that only has 3 buttons for selecting a current language:
I am trying out different approaches and there is also a version that does not use cola at all. For this test though, I am loading the data (an array of objects) from a module that is consumed by 'cola/adapter/Array':
The items in the collection have a status attribute. At start, all languages are inactive, but, as soon as the language_selector_controller is initialized, the default_language will be set to active. And here I have my first problem:
Is there, for this case, a more straightforward and useful way for selecting and updating an item in the collection?
Then, when the user clicks on a button:
the current language, together with the buttons, get updated. And here comes my second problem:
Here I am happy with the current language getting updated, but not with how the other languages are being set to inactive. For now this is the only solution I have managed to come up with, after looking into cola's source code... but for sure there are better ways of doing this!
Any suggestions or hints are warmly welcome.
Thanks!
Decio