소스에 있는 input 으로 입력받는 값을 그룹화 하여 select 항목 변경 채택완료
소스에 있는 input 으로 입력받는 값을 그룹화 하여 select 항목 변경 하고 싶습니다.
고수님들의 조언 좀 부탁 드립니다.
※ 도 | 시군 | 동명 | 분류1| 현재 input 키워드로 입력 받는 값을 그룹화 하여 select 항목으로 변경
input 키워드 -> select 박스 그룹화
Copy
DataTables example - Column filtering
thead input {
width: 100%;
}
$(document).ready(function () {
// Setup - add a text input to each footer cell
$('#example thead tr')
.clone(true)
.addClass('filters')
.appendTo('#example thead');
var table = $('#example').DataTable({
orderCellsTop: true,
fixedHeader: true,
initComplete: function () {
var api = this.api();
// For each column
api
.columns()
.eq(0)
.each(function (colIdx) {
// Set the header cell to contain the input element
var cell = $('.filters th').eq(
$(api.column(colIdx).header()).index()
);
var title = $(cell).text();
$(cell).html('');
// On every keypress in this input
$(
'input',
$('.filters th').eq($(api.column(colIdx).header()).index())
)
.off('keyup change')
.on('keyup change', function (e) {
DataTables example - Column filtering
thead input {
width: 100%;
}
$(document).ready(function () {
// Setup - add a text input to each footer cell
$('#example thead tr')
.clone(true)
.addClass('filters')
.appendTo('#example thead');
var table = $('#example').DataTable({
orderCellsTop: true,
fixedHeader: true,
initComplete: function () {
var api = this.api();
// For each column
api
.columns()
.eq(0)
.each(function (colIdx) {
// Set the header cell to contain the input element
var cell = $('.filters th').eq(
$(api.column(colIdx).header()).index()
);
var title = $(cell).text();
$(cell).html('');
// On every keypress in this input
$(
'input',
$('.filters th').eq($(api.column(colIdx).header()).index())
)
.off('keyup change')
.on('keyup change', function (e) {
e.stopPropagation();
// Get the search value
$(this).attr('title', $(this).val());
var regexr = '({search})'; //$(this).parents('th').find('select').val();
var cursorPosition = this.selectionStart;
// Search the column for that value
api
.column(colIdx)
.search(
this.value != ''
? regexr.replace('{search}', '(((' + this.value + ')))')
: '',
this.value != '',
this.value == ''
)
.draw();
$(this)
.focus()[0]
.setSelectionRange(cursorPosition, cursorPosition);
});
});
},
});
});
도
시군
동명
마트명
과일종류
비용
서울
서초구
서초1동
싸다마트
바나나
1000
서울
서초구
서초2동
빠른마트
바나나
1000
서울
동작구
동작2동
빠른마트
바나나
1000
서울
동작구
동작1동
빠른마트
사과
1000
경기도
수원시
영통1동
빠른마트
사과
1000
경기도
수원시
영통2동
빠른마트
사과
1000
경기도
수원시
영통1동
싸다마트
사과
1000
경기도
수원시
영통1동
싸다마트
바나나
1000
답변 3개
답변을 작성하려면 로그인이 필요합니다.
로그인