2009年1月30日星期五

[fw-mvc] CSS Styles when using Dojo in Zend

I have been playing with Dojo Forms in Zend and wanted to clear something up
regarding their CSS styling.

I believe we have everything running correctly -- it's usually a
Zend_Dojo_Form with several Zend_Dojo_Form_Element_* instances, all set up
programatically through Zend, i.e. without writing any JavaScript ourselves.

Selecting the tundra theme, each time the page was loaded it would display
the form with very minimal styling (in fact, mostly just styles from
dijit.css). After tailing a few logs and having a look around in the
different CSS files I decided to try putting class="tundra" in the html tag.
This rendered the form with the Tundra styles nicely and was far prettier. I
thought it was a little bit 'hacky' though and thought there must be a way
to achieve this in a nicer fashion. After a bit of searching I found this
little snippet from
http://www.nabble.com/Re%3A-Zend-dojo.data-usage%2C-i-dont-understand-p20915966.html
http://www.nabble.com/Re%3A-Zend-dojo.data-usage%2C-i-dont-understand-p20915966.html


* Set the "tundra" class on either the <body> element, or a div
surrounding the form. Let's try the latter:

<?
$this->dojo()->requireModule('dojox.data.QueryReadStore')
->addStylesheetModule('dijit.themes.tundra');
?>
<div class="tundra">
<?= $this->form ?>
</div>


This would suggest I would have to manually add the reference to the tundra
class anywhere I was using Dojo Forms.

Is this the accepted/correct way of setting each element to inherit the
related theme styles? And would it be a bad idea to have this set
automatically like the other classes and javascript codes is when using Dojo
in Zend?
--
View this message in context: http://www.nabble.com/CSS-Styles-when-using-Dojo-in-Zend-tp21750013p21750013.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: