1

私は現在Siwappの 0.5 バージョンで作業しており、請求書テーブルの各行に支払いボタンのポップオーバーを表示しようとしています。しかし、私はクリックでそれをしなければなりません。次のJSコードがあります:

jQuery(function($){

  $('table[data-type="invoices"] a.payments').popover({
    live: true,
    placement: 'left',
    offset: 5,
    html: true,
    content: function() {
      return $(this).attr('class');
    },
    trigger: 'manual'
  }).live('click', function(e){
    e.preventDefault();
    $(this).popover('show');
  });

});

テーブルの HTML は次のようになります (最後のリンクを参照してください)。

<table class="zebra-striped align-middle" data-type="invoices">
  <colgroup>
    <col />
    <col />
    <col class="date" />
    <col class="date" />
    <col class="status" />
    <col class="currency" />
    <col class="currency" />
    <col class="payments" />
  </colgroup>
  <thead>
    <tr>
      <th>{% trans %}Number{% endtrans %}</th>
      <th>{% trans %}Customer{% endtrans %}</th>
      <th>{% trans %}Date{% endtrans %}</th>
      <th>{% trans %}Due Date{% endtrans %}</th>
      <th>{% trans %}Status{% endtrans %}</th>
      <th>{% trans %}Due{% endtrans %}</th>
      <th>{% trans %}Total{% endtrans %}</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>ASET-22</td>
      <td>Roxxon</td>
      <td>5/28/11</td>
      <td>9/16/11</td>
      <td>
        <span class="label important">{% trans %}overdue{% endtrans %}</span>
      </td>
      <td></td>
      <td>$11,435.23</td>
      <td>
        <a href="{{ path('invoice_payments', { 'invoiceId': 4 }) }}" class="btn secondary icon clock payments" title="Payments">{% trans %}Payments{% endtrans %}</a>
      </td>
    </tr>
  </tbody>
</table>

「手動」トリガーを削除すると機能しますが、設定すると機能しません。

誰でもこれを行う方法を知っていますか? ありがとう!

4

2 に答える 2

7

ポップオーバーは、手動で行っていることの一部を自動的に処理しますが、おそらくいくつかの奇妙な競合を引き起こしています. 独自のクリック ハンドラーをそれ自体で実行できる場合に不必要に追加しており、不要と思われるセットアップ関数全体をラップしています。次のようなことを試してください:

$('table[data-type="invoices"] a.payments').popover({
  live: true,
  placement: 'left',
  offset: 5,
  html: true,
  content: function() {
    return $(this).attr('class');
  },
  trigger: 'manual'
});
于 2011-12-09T14:07:37.623 に答える
5

更新情報: Bootstrap 2.1 ではclick、トリガーとして提供できます。( http://twitter.github.com/bootstrap/javascript.html#popovers )

于 2012-09-20T08:55:11.363 に答える