Issue Details (XML | Word | Printable)

Key: ZF-6018
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Matthew Weier O'Phinney
Reporter: Ivaylo Alexandrov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_Dojo_Form_Element_ComboBox doesn't works with zend_dojo_dataStore

Created: 13/Mar/09 04:12 AM   Updated: 01/Jun/09 07:16 AM   Resolved: 13/Mar/09 08:37 AM
Return to search "Fixed in 1.5.1"
Component/s: Zend_Dojo
Affects Version/s: 1.7.6
Fix Version/s: 1.7.7

Time Tracking:
Not Specified

Issue Links:
Duplicate
 


 Description  « Hide

Zend_Dojo_Form_Element_ComboBox doesn't works with zend_dojo_dataStore.
It looks like combobox doesn't call fetch metod of datastore

form class

<?php

require_once ('Zend/Dojo/Form.php');
class Mats_Models_Forms_Test extends Zend_Dojo_Form {
	public function init(){
		$select = $this->createElement('ComboBox','test',
			array(
				'label'=>'test1',
				'storeId'=>'bla',
				'storeType'=>'dojo.data.ItemFileReadStore',
				'storeParams'=>array('url'=>'/Mats/JsonSvc/deliver'),
				'dijitParams'=>array('searchAttr'=>'name'),
				
			)
		);
		$this->addElements(array($select));
	}

}

?>

view

<?$this->layout()->setLayout('djform2')?>
<?=$this->form?>

layout

<?php
/**
 * Default Layout
 *  
 * @author
 * @version
 */
echo '<?xml version="1.0" encoding="UTF-8" ?>';
echo $this->doctype(); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php 
	$this->dojo()->setLocalPath('/scripts/dojo/dojo/dojo.js')->addStylesheetModule('dijit.themes.tundra');
	echo $this->headTitle();
    echo $this->headScript();
    echo $this->headLink();
    echo $this->headStyle(); 
    echo $this->dojo();
?>
</head>
<body class='tundra'>
     <?=$this->layout()->content ?>
</body>
</html>

json controller //Mats/Controllers/JsonSvcController.php

public function deliverAction(){
		$m = new Mats_Models_ProtokoliIn();
		$res = $m->fetchAll($m->select()->from($m,array('id','label'=>'deliver','name'=>'deliver'))->group('deliver'));
		$dj = new Zend_Dojo_Data('id',$res,'deliverStore');
		//echo $m->select()->from($m,array('deliver','id'))->distinct(true);
		
		$this->_helper->autoCompleteDojo($dj);
		
		 
	}

When i add new ComboBox via javascript it works and fetch ItemFileReadStore

w = new dijit.form.ComboBox({name:"phoneNumber",autocomplete:true,
		                searchAttr:"name",store:bla,trim:true},"testDiv");

Generated HTML

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title><style type="text/css">
<!--
    @import "/scripts/dojo/dijit/themes/tundra/tundra.css";
-->
</style>

<script type="text/javascript" src="/scripts/dojo/dojo/dojo.js"></script>

<script type="text/javascript">
//<![CDATA[
dojo.require("dojo.data.ItemFileReadStore");
    dojo.require("dijit.form.ComboBox");
    dojo.require("dijit.form.Form");
    dojo.require("dojo.parser");
dojo.addOnLoad(function() {
    dojo.forEach(zendDijits, function(info) {
        var n = dojo.byId(info.id);
        if (null != n) {
            dojo.attr(n, dojo.mixin({ id: info.id }, info.params));
        }
    });
    dojo.parser.parse();
});
    dojo.addOnLoad(function() {
    bla = new dojo.data.ItemFileReadStore({"url":"\/Mats\/JsonSvc\/deliver"});
});
var bla;
    var zendDijits = [{"id":"test","params":{"store":"bla","searchAttr":"name","trim":"true","dojoType":"dijit.form.ComboBox"}},{"id":null,"params":{"dojoType":"dijit.form.Form"}}];
//]]>

</script></head>
<body class='tundra'>
     <form><dl class="zend_form_dojo">
<dt><label for="test" class="optional">test1</label></dt>

<dd>
<input options="" listsep="&lt;br /&gt;" id="test" name="test" value="" type="text" /></dd></dl></form><script type="text/javascript">
var w;
function testDojo(){

	 w = new dijit.form.ComboBox({name:"phoneNumber",autocomplete:true,
		                searchAttr:"name",store:bla,trim:true},"testDiv");
       
		

	}
	function testValue(){
		alert(w.getValue());
	}
	
</script>
<a href="javascript:void(0)" onclick="testDojo()">test</a>
<a href="javascript:void(0)" onclick="testValue()">test2</a>
<div id="testDiv"></div>
<div id="consol"></div>
</body>
</html>


Matthew Weier O'Phinney added a comment - 13/Mar/09 04:43 AM

This has been reported already, and is due to a bugfix in 1.7.6. I am hoping to get a fix in for 1.7.7, but it may not make it until 1.7.8.


Ivaylo Alexandrov added a comment - 13/Mar/09 04:52 AM

Do you know where is the problem and how to solve it?


Matthew Weier O'Phinney added a comment - 13/Mar/09 06:04 AM

Yes, there is a patch associated with the other issue.


Matthew Weier O'Phinney added a comment - 13/Mar/09 08:37 AM

Fixed in trunk and 1.7 release branch