Zend Dojo Data.grid integration issues

My issue is that my view script pulls in the zend_dojo_data item and I can write a for look and see all the objects, but can not get the items out. The headings for the grid display.  I have a user table set up.  I'll show the code blocks for controller, view script and data output in code blocks below.

First Block will be my controller:

Second Code block will be the view script.

Third code block will be output from the javascript/dojo for loop.  The data comes from:
var store4 = new dojox.data.QueryReadStore({
                    url: '/admin/dojoajaxusers/index',
                        requestMethod: "get"
                });

 

Fourth code block will be data out put passed to the view via normal $htis->view->variable.
 
public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
     	$users = new Mtt_Model_MttUserMapper();
        $results = $users->fetchAll();
        $items = array();
        foreach ($results as $o) {
            $items[] = array('id' => $o->getUserId(),
                            'email'  => $o->getLoginEmail(),
                            'firstname'  => $o->getFirstname(),
                            'lastname'  =>  $o->getLastname(),
            				'expireDate' =>	$o->getExpireDate(),
            				'roll' 		=> $o->getRoll()); 
        }
        $dojoData = new Zend_Dojo_Data('id',$items);
        //echo $dojoData->toJson();
        $dojoData->setLabel('UserData');
        //$this->view->dojodata = $dojoData->toJson();
        $itemsJson = $dojoData->toJson();
        //return 
       
        return $itemsJson;
        //return $this->view->dojodata;
        //return $dojoData->toJson();       
		exit;

    }

Open in new window

<?php echo $this->dojodata ?>
        <style type="text/css">
            @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/grid/resources/Grid.css";
            @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/grid/resources/claroGrid.css";
            .dojoxGrid table { margin: 0; }
        </style>
       
        <script type="text/javascript">

            dojo.require("dojox.grid.DataGrid");
            dojo.require("dojox.data.QueryReadStore");

            dojo.addOnLoad(function() {
                // our test data store for this example:
                //alert(layout4);
                var store4 = new dojox.data.QueryReadStore({
                    url: '/admin/dojoajaxusers/index',
                  	requestMethod: "get"
                });
				for (var i in store4)
				{
					document.write(store4[i]);
					document.write('\<br\>');
				}
                // set the layout structure:
                var layout4 = [
                {
                	field: 'id',
                    name: 'User ID',
                    width: '75px'
                },
                {
                    field: 'email',
                    name: 'Email',
                    width: 'auto'
                },
                {
                    field: 'firstname',
                    name: 'First Name',
                    width: '100px'
                },
                {
                    field: 'lastname',
                    name: 'Last Name',
                    width: '200px'
                },
                {
                    field: 'roll',
                    name: 'Roll',
                    width: 'auto'
                },                
                {
                    field: 'expireDate',
                    name: 'Expires',
                    width: 'auto'
                }];
                //alert('testing' + layout4);
                // create a new grid:


                var grid4 = new dojox.grid.DataGrid({
                    query: {
                        id: '*'
                    },
                    store: store4,
                    clientSort: true,
                    rowSelector: '20px',
                    structure: layout4
                },
                document.createElement('div'));

                // append the new grid to the div "gridContainer4":
                dojo.byId("gridContainer4").appendChild(grid4.domNode);
               

                // Call startup, in order to render the grid:
                grid4.startup();
            });
        </script>
        <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css"
        />
        <div>        <?php //echo $this->dojodate->toJson() ?></div>
        <div id="gridContainer4" style="width: 100%; height: 100%;">

        </div>

Open in new window

/admin/dojoajaxusers/index
get
dojox.data.QueryReadStore

null
-1
null
false
false
null
null
[object Object]
label
function (_8,_9,_a){this._assertIsItem(_8);if(!_4.isString(_9)){throw new Error(this._className+".getValue(): Invalid attribute, string expected!");}if(!this.hasAttribute(_8,_9)){if(_a){return _a;}}return _8.i[_9];}
function (_b,_c){this._assertIsItem(_b);var _d=[];if(this.hasAttribute(_b,_c)){_d.push(_b.i[_c]);}return _d;}
function (_e){this._assertIsItem(_e);var _f=[];for(var i in _e.i){_f.push(i);}return _f;}
function (_10,_11){return this.isItem(_10)&&typeof _10.i[_11]!="undefined";}
function (_12,_13,_14){var _15=this.getValues(_12,_13);var len=_15.length;for(var i=0;ifunction (_16){if(_16){return typeof _16.r!="undefined"&&_16.r==this;}return false;}
function (_17){return this.isItem(_17);}
function (_18){if(this.isItemLoaded(_18.item)){return;}}
function (_19){_19=_19||{};if(!_19.store){_19.store=this;}var _1a=this;var _1b=function(_1c,_1d){if(_1d.onError){var _1e=_1d.scope||_4.global;_1d.onError.call(_1e,_1c,_1d);}};var _1f=function(_20,_21,_22){var _23=_21.abort||null;var _24=false;var _25=_21.start?_21.start:0;if(_1a.doClientPaging==false){_25=0;}var _26=_21.count?(_25+_21.count):_20.length;_21.abort=function(){_24=true;if(_23){_23.call(_21);}};var _27=_21.scope||_4.global;if(!_21.store){_21.store=_1a;}if(_21.onBegin){_21.onBegin.call(_27,_22,_21);}if(_21.sort&&_1a.doClientSorting){_20.sort(_4.data.util.sorter.createSortFunction(_21.sort,_1a));}if(_21.onItem){for(var i=_25;(i<_20.length)&&(i<_26);++i){var _28=_20[i];if(!_24){_21.onItem.call(_27,_28,_21);}}}if(_21.onComplete&&!_24){var _29=null;if(!_21.onItem){_29=_20.slice(_25,_26);}_21.onComplete.call(_27,_29,_21);}};this._fetchItems(_19,_1f,_1b);return _19;}
function (){return this._features;}
function (_2a){}
function (_2b){if(this._labelAttr&&this.isItem(_2b)){return this.getValue(_2b,this._labelAttr);}return undefined;}
function (_2c){if(this._labelAttr){return [this._labelAttr];}return null;}
function (_2d,_2e,_2f,_30){_2d=this._filterResponse(_2d);if(_2d.label){this._labelAttr=_2d.label;}var _31=_2d.numRows||-1;this._items=[];_4.forEach(_2d.items,function(e){this._items.push({i:e,r:this});},this);var _32=_2d.identifier;this._itemsByIdentity={};if(_32){this._identifier=_32;var i;for(i=0;ifunction (_35,_36,_37){var _38=_35.serverQuery||_35.query||{};if(!this.doClientPaging){_38.start=_35.start||0;if(_35.count){_38.count=_35.count;}}if(!this.doClientSorting&&_35.sort){var _39=[];_4.forEach(_35.sort,function(_3a){if(_3a&&_3a.attribute){_39.push((_3a.descending?"-":"")+_3a.attribute);}});_38.sort=_39.join(",");}if(this.doClientPaging&&this._lastServerQuery!==null&&_4.toJson(_38)==_4.toJson(this._lastServerQuery)){this._numRows=(this._numRows===-1)?this._items.length:this._numRows;_36(this._items,_35,this._numRows);}else{var _3b=this.requestMethod.toLowerCase()=="post"?_4.xhrPost:_4.xhrGet;var _3c=_3b({url:this.url,handleAs:"json-comment-optional",content:_38,failOk:true});_35.abort=function(){_3c.cancel();};_3c.addCallback(_4.hitch(this,function(_3d){this._xhrFetchHandler(_3d,_35,_36,_37);}));_3c.addErrback(function(_3e){_37(_3e,_35);});this.lastRequestHash=new Date().getTime()+"-"+String(Math.random()).substring(2);this._lastServerQuery=_4.mixin({},_38);}}
function (_3f){return _3f;}
function (_40){if(!this.isItem(_40)){throw new Error(this._className+": Invalid item argument.");}}
function (_41){if(typeof _41!=="string"){throw new Error(this._className+": Invalid attribute argument ('"+_41+"').");}}
function (_42){if(this._itemsByIdentity){var _43=this._itemsByIdentity[_42.identity];if(!(_43===undefined)){if(_42.onItem){var _44=_42.scope?_42.scope:_4.global;_42.onItem.call(_44,{i:_43,r:this});}return;}}var _45=function(_46,_47){var _48=_42.scope?_42.scope:_4.global;if(_42.onError){_42.onError.call(_48,_46);}};var _49=function(_4a,_4b){var _4c=_42.scope?_42.scope:_4.global;try{var _4d=null;if(_4a&&_4a.length==1){_4d=_4a[0];}if(_42.onItem){_42.onItem.call(_4c,_4d);}}catch(error){if(_42.onError){_42.onError.call(_4c,error);}}};var _4e={serverQuery:{id:_42.identity}};this._fetchItems(_4e,_49,_45);}
function (_4f){var _50=null;if(this._identifier===Number){_50=_4f.n;}else{_50=_4f.i[this._identifier];}return _50;}
function (_51){return [this._identifier];}
function (){var a=arguments,t=a,a0=a[0],f;if(!(this instanceof a.callee)){return _111(a);}if(_113){if(a0){f=a0.preamble;if(f){t=f.apply(this,t)||t;}}f=this.preamble;if(f){f.apply(this,t);}}if(ctor){ctor.apply(this,a);}f=this.postscript;if(f){f.apply(this,a);}}
function _102(name,args){if(typeof name=="string"){return this.inherited(name,args,true);}return this.inherited(name,true);}
function _fa(_fb,a,f){var _fc,_fd,_fe,_ff,meta,base,_100,opf,pos,_101=this._inherited=this._inherited||{};if(typeof _fb=="string"){_fc=_fb;_fb=a;a=f;}f=0;_ff=_fb.callee;_fc=_fc||_ff.nom;if(!_fc){err("can't deduce a name to call inherited()",this.declaredClass);}meta=this.constructor._meta;_fe=meta.bases;pos=_101.p;if(_fc!=_ee){if(_101.c!==_ff){pos=0;base=_fe[0];meta=base._meta;if(meta.hidden[_fc]!==_ff){_fd=meta.chains;if(_fd&&typeof _fd[_fc]=="string"){err("calling chained method with inherited: "+_fc,this.declaredClass);}do{meta=base._meta;_100=base.prototype;if(meta&&(_100[_fc]===_ff&&_100.hasOwnProperty(_fc)||meta.hidden[_fc]===_ff)){break;}}while(base=_fe[++pos]);pos=base?pos:-1;}}base=_fe[++pos];if(base){_100=base.prototype;if(base._meta&&_100.hasOwnProperty(_fc)){f=_100[_fc];}else{opf=op[_fc];do{_100=base.prototype;f=_100[_fc];if(f&&(base._meta?_100.hasOwnProperty(_fc):f!==opf)){break;}}while(base=_fe[++pos]);}}f=base&&f||op[_fc];}else{if(_101.c!==_ff){pos=0;meta=_fe[0]._meta;if(meta&&meta.ctor!==_ff){_fd=meta.chains;if(!_fd||_fd.constructor!=="manual"){err("calling chained constructor with inherited",this.declaredClass);}while(base=_fe[++pos]){meta=base._meta;if(meta&&meta.ctor===_ff){break;}}pos=base?pos:-1;}}while(base=_fe[++pos]){meta=base._meta;f=meta?meta.ctor:base;if(f){break;}}f=base&&f;}_101.c=f;_101.p=pos;if(f){return a===true?f:f.apply(this,a||_fb);}}
function _103(cls){var _104=this.constructor._meta.bases;for(var i=0,l=_104.length;idojox.data.QueryReadStore

Open in new window

{"identifier":"id","items":[{"id":"3","email":"pete@mail.com","firstname":"pete","lastname":"cooper","expireDate":null,"roll":null},{"id":"5","email":"2efdce4317500e029051f1fa9c9c2337","firstname":"gail","lastname":"harris","expireDate":null,"roll":"guest"},{"id":"6","email":"c86f0af55aacdd4db63bdbe9eb2eefa2","firstname":"joe","lastname":"goe","expireDate":null,"roll":"guest"},{"id":"7","email":"e@eee.com","firstname":"e","lastname":"eee","expireDate":null,"roll":"guest"},{"id":"8","email":"al@yarr.com","firstname":"al","lastname":"yarr","expireDate":null,"roll":"guest"},{"id":"9","email":"barb@next.com","firstname":"barb","lastname":"next","expireDate":null,"roll":"guest"},{"id":"10","email":"missy@sixth.com","firstname":"missy","lastname":"sixth","expireDate":null,"roll":"guest"},{"id":"11","email":"fred@smith.com","firstname":"fred","lastname":"smith","expireDate":null,"roll":"guest"},{"id":"12","email":"able@baker.com","firstname":"Able","lastname":"Baker","expireDate":null,"roll":"guest"},{"id":"13","email":"ted@turner.com","firstname":"ted","lastname":"turner","expireDate":null,"roll":"guest"}]}

Open in new window

MTTDevAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MTTDevAuthor Commented:
I get this error message: "Sorry, an error occurred"
on attempting to load.
0
MTTDevAuthor Commented:
Problem Solved.  I moved the code out of the indexAction and put it in a gridAction so that way the only thing I was getting back was the Json output.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MTTDevAuthor Commented:
The response was only looking for Json data, but in my indexAction (Zend Framework) it was calling the index.phtml file which was returning HTML as well.  Moving it into its own action and turning off the layout and the view->renderer the gridAction script only returned Json data format.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.