2016-09-29 37 views
0

我有一個問題,我不能修復。我想移動一個div列表(它們是由handlebars創建的)並對它們進行排序,但是我無法做到,我無法解決。jQuery .sortable()不能與句柄工作

這裏是我的代碼:

<script id="template-listado" type="text/x-handlebars-template"> 
    <ul> 
     {{#each listado}} 
     <li id="sortable"> 
      <div>{{descripcion}}</div> 
      <div>{{activo}}</div> 
     </li> 
     {{/each}} 
    </ul> 
</script> 

HTML

<div class="container" style="width :900px"> 
    <form name="sinapsis" id="sinapsis" method="post"> 
    <div class="titulo_pagina"> 
    <h3>##$ADM_BANNER##</h3> 
    </div> 
    <div id="listado"> 
    <script> 
     $("#sortable").sortable();  
    </script> 
    </div> 
</div> 

車把腳本工作正常。這是注入

任何建議?

回答

0

Okey問題已得到解決。

我嘗試在元素werent創建時使用可排序函數。我把這個jQuery調用放在handlebars注入之後。

init : function(){ 
 
    MediaObject.crearObjeto(); 
 
    var dlg2 = null; 
 
    this.dlg2 = dlg2 = new DialogBox(); 
 
    var navegador = BCheck(); 
 
    var formulario = new FormMgr("sinapsis", navegador); 
 

 
    MediaObject.templateContenido = Handlebars.compile($("#template-listado").html()); 
 
    MediaObject.pintarListado(); 
 

 
    $("#listado > ul").sortable(); \t \t \t \t \t  
 
},