jQuery DataTables プラグインの検索機能で、テーブル セル内の HTML タグを無視するにはどうすればよいですか。例 : 文字列 " を含むセルを考えます。
こんにちは"、「こんにちは」と入力しても何も返されませんでした
jQuery DataTables プラグインの検索機能で、テーブル セル内の HTML タグを無視するにはどうすればよいですか。例 : 文字列 " を含むセルを考えます。
こんにちは"、「こんにちは」と入力しても何も返されませんでした
使用sType
またはmData
オプション。以下は、datatables api http://datatables.net/usage/columns#mData、http://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 形式でデータを取得する場合のソリューションです。