【问题标题】:jQuery .sortable() doesnt work with handlebarsjQuery .sortable() 不适用于车把
【发布时间】:2016-09-29 11:37:13
【问题描述】:

我有一个无法解决的问题。我想移动一个 div 列表(它们是由车把创建的)并对其进行排序,但我无法做到,也无法解决。

这是我的代码:

<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>

车把脚本运行良好。这是注入

有什么建议吗??

【问题讨论】:

    标签: javascript jquery jquery-ui jquery-ui-sortable


    【解决方案1】:

    好的,问题已经解决了。

    当元素尚未创建时,我尝试使用可排序功能。我在把手注入之后放置了 jQuery 调用。

    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();					    
    },

    【讨论】:

      猜你喜欢
      • 2022-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-10
      • 2017-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多