我一直在試圖讓我的Zend Framework應用程序的JQuery Sortable工作,但只有有限的成功。我一直在使用ZendX庫來處理大多數我需要的Jquery功能,比如datepicker,而且這些工作都很好。我似乎無法排序到ZendX庫中不支持的地方。Zend Framework Jquery Sortable
至於代碼。在我的引導我已經定義的jQuery等輔助路徑按useual:
protected function _initViewHelpers()
{
$view = new Zend_View();
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$view->jQuery()->setLocalPath('http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')
->setUiLocalPath('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js')
->addStylesheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css');
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
我然後使用echo $this->jQuery()->enable();
佈局激活JQuery的現在,這一切工作正常,在日期選擇作品和它顯示了光滑設計意圖等
現在我實現了一個小單子用簡單的排序腳本在我index.phtml如下:
<!DOCTYPE html>
<html>
<head>
<script>
$(document).ready(function() {
$("#sortable").sortable();
});
</script>
</head>
<body style="font-size:62.5%;">
<ul id="sortable">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</body>
</html>
我可以得到這個工作的唯一方法是將行
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
添加到index.phtml。這對我來說看起來就像是一樣荒謬。在bootstrap中,我已經添加了這個腳本,爲什麼我不得不再次執行這個操作只是爲了讓排序工作?
任何碰巧遇到問題的解決方案?
任何意見可以理解的:)
能不能請你投我的答案,因爲這是完美滿足您的需求 –