0
votes

I'm following this guide using the declarative example: http://dojotoolkit.org/reference-guide/1.9/dijit/form/Textarea.html#id2

But for some reason it's not working at all. It shows that it's working in the example on the Dojo site, but when I put it on my webpage it doesn't do what it's suppose to do, which is auto resize the text area to the content. The first example, programmatic, works fine.

Here you can see that on Plunker it's also not working: http://plnkr.co/edit/v5MngysRgo5509isCMa1?p=preview

I've inserted both example and as you can see, the programmatic way works but the declarative way isn't.

What's going on?

1

1 Answers

1
votes

Well, you already found out you have to parse the page. This can be done either manually using the dojo/parser module or automatically by providing a dojoConfig object (or data-dojo-config) and using parseOnLoad: true.

You're using this last approach but there's one small (and important) detail. The dojoConfig must be loaded before the dojo.js script. I recommend reading this Dojo tutorial which is all about configuring Dojo. The second yellow notice/block already says that:

Notice that dojoConfig is defined in a script block before dojo.js is loaded. This is of paramount importance—if reversed, the configuration properties will be ignored.

Another thing I noticed in your example is that you also need a Dojo theme for most widgets to work properly. You can do this by adding a theme like http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dijit/themes/claro/claro.css and then you only need a parent with the class="claro" attribute. Usually it's done at the <body> tag.

I forked your Plunker code and updated it a bit. I'm not used to Plunker but I think this is the correct URL: http://plnkr.co/edit/O4A6pWnpXRGyVr4gzZ8x?p=preview