0

<br>jquery-bootgrid を使用してセル内を表示する方法はありますか? のレンダリングが表示さ<br>れないためです。

4

2 に答える 2

2

私が理解しているのは、データに次のような改行を追加したいということです。

ここに画像の説明を入力

機能列で配列を渡し、各アイテムを別の行に表示します<br>

このために、カスタム コンバーターを作成できます。

http://www.jquery-bootgrid.com/Documentation#converters

BootGrid テーブルの初期化時にコンバーターを作成できます。

var dt = $('#myTable').bootgrid({
  //.......... Other Options
  converters: {
    listDisplay: {
      from: function(value) {
        return value;
      },
      to: function(value) {

     // Here you can customise value - I have an Array which I join using <br>

        value.sort();
        value = value.join("<br/>");
        return value;
      }
    }
  }
});

次に、テーブル HTML で行う必要があるのは、列見出しにデータ型を設定することだけです

    <table  id="myTable">
      <thead>
        <tr>
          <th data-column-id="Id" data-visible="false" data-identifier="true" data-type="numeric">Id</th>

          <th data-column-id="SelectedFeaturesNames" data-type="listDisplay">Features</th>

<!-- Note the data-type on the Features <th> is listDisplay -->

        </tr>
      </thead>
      <tbody></tbody>
    </table>
于 2016-05-05T14:56:02.903 に答える