2012-11-02 4 views
0

jQuery DataTables 플러그인의 검색 기능을 만들려면 어떻게해야합니까? 표 셀에서 HTML 태그를 무시하십시오. 예 : I 입력 할 때 문자열 "HTML 태그로 셀 필터링

Hello
"를 포함하는 셀을 고려 "안녕하세요", 아무것도

답변

0

사용 sType 또는 mData 옵션을 반환하지 않습니다.

사용 STYPE 필터링 할 때 당신은 단지 HTML 태그를 제거하려면 : 컬럼에 aoColumnDefs 정의를 사용 mData 복잡한 값 편집

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

당신이 원하는 여기 http://datatables.net/usage/columns#sType datatables API를 http://datatables.net/usage/columns#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 형식으로 가져 오는 경우이 방법이 유용합니다.

+0

Json Format에 데이터가 없습니다. 더 간단하다고 생각했습니다. (.. 어쨌든 고맙습니다. – Seif

+0

'sType'을 사용하고 모든 열에 대해 'html'로 설정합니다. –

관련 문제