【问题标题】:Sorting custom template with Ng-Table in AngularJS在 AngularJS 中使用 Ng-Table 对自定义模板进行排序
【发布时间】:2020-09-24 20:27:02
【问题描述】:

我遵循了这个指南:Documentation

我写了这段代码:

<script type="text/ng-template" id="limiteRecDosExpl.html">
    <p sortable="'limiteRecDosExpl'">Limite réception fin<br />du dossier exploitant</p>
</script>

.....

<td filter="{ limiteRecDosExpl : 'text'}" header="'limiteRecDosExpl.html'" >
    <div style="word-wrap: break-word; width: 100%; overflow: hidden;">
        <span>{{row.limiteRecDosExpl | date:'shortDate'}}</span>
    </div>
</td>

过滤器工作得很好,但脚本标签内的可排序指令却不行。 我认为是因为缺少 data-title 标记,但我需要用 打破标题内的文本,所以我不能使用它。

如何对我的 limiteRecDosExpl 列进行排序?

【问题讨论】:

    标签: javascript html angularjs sorting ngtable


    【解决方案1】:

    终于解决了这个问题。

    只需在模板中的 td 标签中添加一个空的 data-title 和 sort-indicator 类到 p 标签中:

    <script type="text/ng-template" id="limiteRecDosExpl.html">
        <p class="sort-indicator">Limite réception fin<br />du dossier exploitant</p>
    </script>
    
    .....
    
    <td filter="{ limiteRecDosExpl : 'text'}" header="'limiteRecDosExpl.html'" data-title="''" >
        <div style="word-wrap: break-word; width: 100%; overflow: hidden;">
            <span>{{row.limiteRecDosExpl | date:'shortDate'}}</span>
        </div>
    </td>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多