I have been trying to get JQuery Sortable working on my Zend Framework application but only with limited succes. I have been using the ZendX library for most of the Jquery functionality that i need such as the datepicker and those work perfectly fine. I just can't seem to be able to get sortable to wich is not supported in the ZendX library.
As for the code. In my bootstrap i have defined the helper path for Jquery etc. as per 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);
}
I then activate JQuery in the layout using echo $this->jQuery()->enable();
Now this works all fine, the datepicker works and it shows the Smoothness design as intended etc.
Now i implement a small list with a the simple sortable script as follows in my 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>
The only way i can get this to work is to add the line
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script>
to the index.phtml. This to me looks just about as ridiculous as it gets. in the bootstrap i already add this script so why should i have to do this again just to get sortable to work?
Anyone happen to have a solution to my problem?
Any advice will be appreciated :)