0

jQuery DataTables プラグインの検索機能で、テーブル セル内の HTML タグを無視するにはどうすればよいですか。例 : 文字列 " を含むセルを考えます。

こんにちは
"、「こんにちは」と入力しても何も返されませんでした

4

1 に答える 1

0

使用sTypeまたはmDataオプション。以下は、datatables api http://datatables.net/usage/columns#mDatahttp://datatables.net/usage/columns#sTypeの例です。

フィルタリング時に sType を使用して html タグを取り除きたいだけの場合:

"aoColumnDefs": [
      { "sType": "html", ... } // column[0] settings
    ]

aoColumnDefs定義で複雑な値を編集するには、mDataフィルターする列で使用します。

"mData": function ( source, type, val ) {
        if (type === 'set') { 
          source.<data> = val;
          // Store the computed dislay and filter values for efficiency
          source.<data>_display = ...; // value to be display
          source.<data>_filter  = ...; // value for filtering
          return;
        }
        else if (type === 'display') {
          return source.<data>; // example source.price
        }
        else if (type === 'filter') {
          return source.<data>_filter; // this si that you are looking for.
        }
        // 'sort', 'type' and undefined all just use default value
        return source.<data>;
      }

これは、JSON 形式でデータを取得する場合のソリューションです。

于 2012-11-02T15:36:03.373 に答える