부트 스트랩 표 플러그인 (http://bootstraptable.wenzhixin.net.cn/documentation/)을 사용 중이며 filterby
방법을 사용하여 태그별로 필터링하려고하지만 여러 태그를 고려해야하는 방법을 알아낼 수 없습니다. 쉼표로 구분 된 문자열 형식입니다.부트 스트랩 문자열 부분 표 필터
나는 달성하려는 것을 보여주기 위해 예제를 만들었습니다. filterby
방법으로 또는 필터 확장 중 하나에서 다음 중 하나를
<table id="table">
<thead>
<tr>
<th data-field="date">Date</th>
<th data-field="desc">Description</th>
<th data-field="tags">Tags</th>
</tr>
</thead>
</table>
<br>
<button id="filter-general">General</button>
<button id="filter-rotation">Rotation</button>
<button id="clear">clear</button>
자바 스크립트 :
var data = [{
"date": "2016-05-10",
"tags": "General, Research, Rotation",
"desc": "Nunc velit lectus, ornare vitae fringilla eget, vestibulum quis tortor."
},{
"date": "2016-04-22",
"tags": "General",
"desc": "Nunc velit lectus, ornare vitae fringilla eget, vestibulum quis tortor."
},{
"date": "2016-03-23",
"tags": "Research, Rotation",
"desc": "Nunc velit lectus, ornare vitae fringilla eget, vestibulum quis tortor."
},{
"date": "2015-11-01",
"tags": "Rotation",
"desc": "Nunc velit lectus, ornare vitae fringilla eget, vestibulum quis tortor."
},{
"date": "2016-08-15",
"tags": "General, Rotation",
"desc": "Nunc velit lectus, ornare vitae fringilla eget, vestibulum quis tortor."
}];
$(function() {
$table = $('#table');
$table.bootstrapTable({
data: data
});
$('#clear').click(function() {
$table.bootstrapTable('filterBy', {});
});
$('#filter-general').click(function() {
$table.bootstrapTable('filterBy', {
tags: "General"
});
});
$('#filter-rotation').click(function() {
$table.bootstrapTable('filterBy', {
tags: "Rotation"
});
});
});
http://jsfiddle.net/zqxwr3uL/6/
편집을 단순화하기 위해,
다음은 HTML입니다.
두 확장 중 하나가이 동작을 수행 할 수 있다고 생각하십니까? 아직도 그것을보고 있지만 부분 문자열로 어떻게 보일 수 있는지 전혀 이해할 수 없습니다. –