2026, 새로운 도약을 시작합니다.

소스에 있는 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개

채택된 답변
+20 포인트

글 내용만으로 정확히 원하는 것이 어떤 것인지 잘 이해가 안됩니다.

그래서 비슷한 것을 찾아 봤는데,   답은 아닌것 같지만,

도움이 될수도 있을 것 같아서...

https://stackoverflow.com/questions/40950649/how-to-take-values-from-multiple-options-of-select-input-field

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

자체 해결 했습니다.  감사합니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

자체 해결 했습니다.  감사합니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고