Re: [qooxdoo-devel] Bind selectbox and list controllers
Brought to you by:
ecker,
martinwittemann
From: Martin W. <Mar...@1u...> - 2011-03-31 06:08:44
|
Hey, > While we are here, I have another question, that bothers me. Why does > console.log(listController.getModel()) always show an empty array? > I've looked at the model before, but ignored it due to its > "emptiness".. Thats also one source of distraction for data binding rookies. The reason is pretty simple. Your console things that your model is a plain array, because it has a length property. Unfortunately, it tries to access the data like it is a usual array (model[0] e.g.) but that does not work as its a data array and you have to use getItem and setItem but the console doesn't know that. If you see that and you know its a qooxdoo data array, try to call "toArray()" on it which returns the native representation of it which can be handle by the console. >> Do you also plan to synchronize the selection of list and selectbox? That could be a bit more tricky because you are not using the default model for the selectbox (see bindItem of the select box). > > Not at the moment, but if you wish to elaborate, I'll be happy to read > about that. I guess then we can move that topic to the point you need it. ;) > And here is extended playground example for future reference - while I > needed to handle inserting new data as well, I've added it to the > code: http://tinyurl.com/6jwvfnu Thats looking good. :) Best, Martin |