Sudheer wrote:
var counter = 0;
function moreWidgets() {
counter++;
var stateSelect = new Array();
list = stateSelect[counter];
var filteringSelect = new dijit.form.FilteringSelect(
{ id: stateSelect[counter], name:
"productId[" + counter + "]", searchAttr:
"productName"
}, "list");
newStore = new
dojo.data.ItemFileReadStore({url: '/product/jsonlist'});
filteringSelect.store = newStore;
[...]
When the function moreWidgets() is called, it is unable to create
the filteringSelect widget. If I comment out the lines that create
and append filteringSelect, the function works well. It also
creates the other price and quantity elements when the
filteringSelect lines are commented. But the script halts when the
filteringSelect lines are uncommented.
I get the message
"root is null
si = root.selectedIndex; file /js/dojo...mboBox.js (line
1051)" in firebug console.
I would have asked the question in the dojo forums. But anyway ...
here is a guess. Line 1051 in ComboBox.js is
dijit.form._ComboBoxDataStore.fetchSelectedItem(). That's the store,
which uses a select node instead of a normal store. So I think you
should first create the store and give that as a param to the
constructor of dijit.form.FilteringSelect.
BTW in firebug you can normally check which line of your code causes
the error, with the backtrace and the function parameters in the
trace. Or you set breakpoint, add watches and step through the code to
see what goes wrong.
nico