2008年12月9日星期二

Re: [fw-mvc] Zend dojo.data usage, i dont understand

Matthew Weier O'Phinney-3 wrote:
>
> Two things.
>
> First, did you use Zend_Dojo_Form or extend Zend_Dojo_Form? I'm
> assuming, based on the fact that you got an input, that you did.
>
> Second, did you specify a dijit theme at any point? If not, you need to
> do two things:
>
> Matthew Weier O'Phinney
> Software Architect | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>

Yes, i am using both, zend dojo form and i specified theme in body tag.
I am using Zend_Dojo_Form as follow:
(inside WebMastersController.php)
****************************************************************************
public function viewAction ()
{
$form = new Zend_Dojo_Form();

$form->setMethod('post')->setAction("../admin/news/process")->setName('editNews');
$form->setDecorators(array (
'FormElements' , array (
'ContentPane' , array (
'id' => 'newsPane' , 'style' => 'width:100%; ', 'dijitParams' =>
array (
'tabPosition' => 'top'
)
)
) , 'DijitForm'
));
$input = new Zend_Dojo_Form_SubForm();
$input->addElement('ComboBox', 'myAutoCompleteField', array (
'label' => 'My autocomplete field:' , 'storeId' => 'autocompleter' ,
// used as a JS variable name by dojo
'storeType' => 'dojox.data.QueryReadStore' , // type of dojo.data store;
this is a
'storeParams' => array (
'url' => 'admin/webmasters/autocomplete' // specify the
appropriate URL for
)// data store handler

));
$form = $form->addSubForm($input, 'memberName');
$this->view->autoComplete = $form;
}
*******************************************************************************
in my view.phtml :
<ol id="wp">
<li id="bd">
<ol id="doc">
<li id="s1"><?= $this->partial('menu.phtml')?></li>

<li id="s2">
<?= $this->autoComplete ?>
</li>
</ol>
</li>
</ol>
********************************************************************************
in my main layout.phtml (all others dojo forms works properly)
.... </head>
<body class="tundra">.......

i created indexAction inside WebmasterController.php as follow:
******************************************************
public function indexAction ()
{
$model = new AdminWebmasters();
$params = $this->getRequest()->getQuery();
$results = $model->query($params);
$this->view->data = new Zend_Dojo_Data('username', $results,
'name');
}
******************************************************
and my model looks like:
//AdminWebmasters.php
class AdminWebmasters extends Zend_Db_Table_Abstract
{
/**
* The default table name
*/
protected $_name = 'webmasters';
protected $db;
public function __construct ()
{
$this->db = Zend_Registry::get('db');
}
public function getAllWebmasters ($params)
{
$select = $this->db->select()->from('webmasters', array (
'*'
));
return $this->db->fetchAll($select);
}
}

At the end, when i load http://mysite.com/admin/webmasters/view
my form (autocomplete) still looks like ordinary input field. (on other
pages, with other zend_dojo_form everything works good)
Also, i see that firebug trowns an error:
Could not load 'dojo.data.QueryReadStore'; last tried
'./data/QueryReadStore.js'

I atached a print screen of that.
http://www.nabble.com/file/p20916423/dojoError.gif dojoError.gif
Thanks,
V
--
View this message in context: http://www.nabble.com/Zend-dojo.data-usage%2C-i-dont-understand-tp20912322p20916423.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: