2008年12月9日星期二

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

Thanks Matt.
Yes i am using Dojo from 1.6 distribution i think, i tried to put new dojo
in(from 1.7), but then nothing was working.
How to find right mathces? :)
did i do right within my model and idnexAction? I posted them both above. :D
Thanks
V

Matthew Weier O'Phinney-3 wrote:
>
> -- vladimirn <nezaboravi@gmail.com> wrote
> (on Tuesday, 09 December 2008, 07:58 AM -0800):
>> Thank you Matt, i got form to be displayed as a Zend_dojo form and happy
>> now
>> :)
>> Alas!
>> When i am trying to put some value inside the input field, i am getting
>> an
>> error. Please note the Attached file:
>> http://www.nabble.com/file/p20917454/dojoError.gif dojoError.gif
>
> You must be using a pre-1.2 series of dojo. :)
>
> You can turn off those warnings using the following:
>
> $this->dojo()->setDjConfig('usePlainJson', true);
>
> The validation error is because if found no matches.
>
>> Do i need to provide more data so you can be able to help me on this? :)
>> Thanks,
>> V
>>
>> Matthew Weier O'Phinney-3 wrote:
>> >
>> > -- vladimirn <nezaboravi@gmail.com> wrote
>> > (on Tuesday, 09 December 2008, 07:10 AM -0800):
>> >> 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:
>> >>
>> >> 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');
>> >
>> > Bad action -- use the URL action or view helper to form your URLs.
>> >
>> >> $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
>> >
>> >
>> > Bad url -- it should begin with a '/'. Rule of thumb: use the URL
>> action
>> > or view helper to form your URLs.
>> >
>> >
>> >> )// 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'
>> >
>> > Again, use "dojox.data.QueryReadStore" -- note the "x" following
>> "dojo".
>> >
>> >
>> >> I atached a print screen of that.
>> >> http://www.nabble.com/file/p20916423/dojoError.gif dojoError.gif
>> >
>> > --
>> > Matthew Weier O'Phinney
>> > Software Architect | matthew@zend.com
>> > Zend Framework | http://framework.zend.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Zend-dojo.data-usage%2C-i-dont-understand-tp20912322p20917454.html
>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>
>
> --
> Matthew Weier O'Phinney
> Software Architect | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>
>

--
View this message in context: http://www.nabble.com/Zend-dojo.data-usage%2C-i-dont-understand-tp20912322p20918119.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: