我有一个用 CakePHp v1.3 编写的用户管理系统,我想对用户进行排序。所以我正在使用 jquery dialog-ui (让我们说类似于 facebook 朋友列表)并通过添加最新用户的 ajax 页面加载它。
在这个列表中,我希望能够使用 jquery sortable-ui 但由于某种原因我不能。我猜javascript没有加载?如果发生这种情况,我无法在萤火虫中看到,所以如果有人知道可以做什么,请帮助我。
这是代码:这会触发对话框:
<div onClick="manageCoauthors(data={'id':'<?php echo $this->params['pass'][0]; ?>'});" class="floatRight allImg leftManageFDs" style="cursor: pointer"></div>
然后这是打开对话框的javascript:
$('#dialog-manage-coauthors').load(fdBaseUrl + 'publications/ajaxManageCoauthors/' + paperID).dialog({
resizable: false,
modal: true,
width:500,
height:400,
buttons:{
"OK": function(){
$(this).dialog('close');
}
}
});
以及使用 ajax 加载的页面内容将填充 dialog-ui 容器
<style>
#sortable { list-style-type: none; margin: 0; padding: 0; cursor: move }
#sortable li { margin: 3px 3px 3px 0; padding: 1px; float: left; width: 50px; height: 50px; font-size: 4em; text-align: center; }
</style>
<script type="text/javascript">
$(document).ready(function(){
//initialize sortable
$("#sortable").sortable({
/*update: function(){
var order = $('#sortable').sortable('serialize');
$.ajax({
url: fdBaseUrl + 'cv/orderParahraphs',
data: order,
dataType: 'json'
})
}*/
});
$( "#sortable" ).disableSelection();
});
</script>
<?php
if(isset($publicationColaborators) && !empty($publicationColaborators)){
?>
<ul id="sortable" class="ui-sortable">
<?php
foreach($publicationColaborators as $colaboratorDetail){
//debug($colaboratorDetail);
$profile_image = 'users/profile/' .
md5((isset($colaboratorDetail['User']) ? $colaboratorDetail['User']['id'] : $colaboratorDetail['id'])) . DS .
(isset($colaboratorDetail['User']) ? $colaboratorDetail['User']['profile_photo'] : $colaboratorDetail['profile_photo']);
$options = array('gender'=>(isset($colaboratorDetail['User']) ? $colaboratorDetail['User']['gender'] : $colaboratorDetail['gender']),
'size' => '40',
'link'=>(isset($colaboratorDetail['User']) ? $colaboratorDetail['User']['slug'] : $colaboratorDetail['slug']),
'title'=>$this->Fellow->fullUserVisitCard((isset($colaboratorDetail['User']) ? $colaboratorDetail['User'] : $colaboratorDetail)));
?>
<li class="ui-state-default">
<div class="floatLeft" style="padding:10px;">
<div onClick="removeColaborator(data={'id':'<?php echo (isset($colaboratorDetail['User']) ? $colaboratorDetail['User']['id'] : $colaboratorDetail['id']); ?>', 'paperID':'<?php echo $paperID; ?>'})" style="position: absolute; margin-left:27px" class="allImg wall_post_actions_delete_active"></div>
<?php
echo $this->Fellow->checkImage($profile_image, $options);
?>
</div>
</li>
<?php
}
?>
</ul>
<?php
}
else{
echo __d('publications', 'You have no co-authors yet', true);
}
?>
<div class="clearDiv"></div>