Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery sortable-ui inside a dialog-ui that loads a page via ajax
    text
    copied!<p>I have a user management system written in CakePHp v1.3 where I want to sort the users. So I am using jquery dialog-ui (let's say similar to facebook friends list) and loading this via a ajax page with latest users added.</p> <p>In this list I want to be able to use jquery sortable-ui but for some reason I cannot. I guess the javascript is not loaded? I cannot see in firebug if this is happening or not so if anyone knows what can be done please help me.</p> <p>Heres the code: This triggers the dialog:</p> <pre><code>&lt;div onClick="manageCoauthors(data={'id':'&lt;?php echo $this-&gt;params['pass'][0]; ?&gt;'});" class="floatRight allImg leftManageFDs" style="cursor: pointer"&gt;&lt;/div&gt; </code></pre> <p>Then this is the javascript for opening the dialog:</p> <pre><code>$('#dialog-manage-coauthors').load(fdBaseUrl + 'publications/ajaxManageCoauthors/' + paperID).dialog({ resizable: false, modal: true, width:500, height:400, buttons:{ "OK": function(){ $(this).dialog('close'); } } }); </code></pre> <p>And the content of the page loaded with ajax that will populate the dialog-ui container</p> <pre><code>&lt;style&gt; #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; } &lt;/style&gt; &lt;script type="text/javascript"&gt; $(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(); }); &lt;/script&gt; &lt;?php if(isset($publicationColaborators) &amp;&amp; !empty($publicationColaborators)){ ?&gt; &lt;ul id="sortable" class="ui-sortable"&gt; &lt;?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'=&gt;(isset($colaboratorDetail['User']) ? $colaboratorDetail['User']['gender'] : $colaboratorDetail['gender']), 'size' =&gt; '40', 'link'=&gt;(isset($colaboratorDetail['User']) ? $colaboratorDetail['User']['slug'] : $colaboratorDetail['slug']), 'title'=&gt;$this-&gt;Fellow-&gt;fullUserVisitCard((isset($colaboratorDetail['User']) ? $colaboratorDetail['User'] : $colaboratorDetail))); ?&gt; &lt;li class="ui-state-default"&gt; &lt;div class="floatLeft" style="padding:10px;"&gt; &lt;div onClick="removeColaborator(data={'id':'&lt;?php echo (isset($colaboratorDetail['User']) ? $colaboratorDetail['User']['id'] : $colaboratorDetail['id']); ?&gt;', 'paperID':'&lt;?php echo $paperID; ?&gt;'})" style="position: absolute; margin-left:27px" class="allImg wall_post_actions_delete_active"&gt;&lt;/div&gt; &lt;?php echo $this-&gt;Fellow-&gt;checkImage($profile_image, $options); ?&gt; &lt;/div&gt; &lt;/li&gt; &lt;?php } ?&gt; &lt;/ul&gt; &lt;?php } else{ echo __d('publications', 'You have no co-authors yet', true); } ?&gt; &lt;div class="clearDiv"&gt;&lt;/div&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload