Nico Edtinger wrote:
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.
Thanks for the response. Few kind folks helped me on #dojo for couple of
hours. Unfortunately. we were unable to resolve the issue. I have an
example HTML page where the same moreWidgets() function works well. I
only get this issue when trying to integrate into the application that
uses Zend Framework.
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.
Few folks on #dojo also suspected this to be cause. But it is not. Like
I said above, I have a clean working example which generates input
element with filteringSelect widget before the store is created.
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.
In the firebug console I get "TypeError: root is undefined" error when I
execute the following JavaScript line
var product = new dijit.form.FilteringSelect();
However, I can execute the same line in the firebug console when the
working example page is loaded. It returns an object and does not show
any error.
I suspect, the issue lies somewhere in ZF and Dojo integration. Of
course, I could be wrong. You can reproduce this behaviour by doing the
following steps:
1. Create a Zend_Form object with couple of sample elements.
2. Use dojo() view helper to specify path and stylesheet themes to use
3. Write a JavaScript function that creates an element with
filteringSelect widget and include it in your view/layout.
4. Call the JavaScript function that you wrote in step 3.
One more fact I have observed is, this is happening with only the
filteringSelect dijit.
Regards,
--
Sudheer Satyanarayana
Binary Vibes Information Technologies Pvt. Ltd.
Postal Address: #506, 10th B Main Road, I Block, Jayanagar, Bangalore – 560 011
URL : www.binaryvibes.co.in
Phone: +91 80 41558451 * Mobile: +91 99005 07499
Community : http://lampcomputing.com