select search for multi column is not working

select search for multi column is not working

haiderTyagihaiderTyagi Posts: 11Questions: 2Answers: 0
edited August 2017 in Free community support
      **  column.data().unique().sort().each(function (d, j) {

                            select.append('<option value="' + d + '">' + d + '</option>')
                        });**

when i **alert(d) ** :**)

d have values **of type

<span id="ctl00_ContentPlaceHolder1_mygdv_ctl03_lblSerialNo">2</span>

<span id="ctl00_ContentPlaceHolder1_mygdv_ctl06_lblName">RAJASHTHAN</span>

<input type="image" name="ctl00$ContentPlaceHolder1$mygdv$ctl04$t_code1" id="ctl00_ContentPlaceHolder1_mygdv_ctl04_t_code1" src="../images/delete%20Icon.png" onclick="javascript:return confirm('Are you sure to delete State JAMMU &amp; KASHMIR');" style="border-width:0px;">

when i bound it,, as it is... filter is not working because value is showing in drop down is like 2>2

i resolve this issue by using
column.data().unique().sort().each(function (d, j) { a=$(d).text(); select.append('<option value="' + a + '">' + a+ '</option>') });

Now Its Working Fine(But only for any one column )

**-filtering work only for one column which i choose very first(any of those) -- **

Issue is --
_if select value from other column filter drop down,, its shows record if that record is present previous column filtered record and if it is not then shoe no match found _

and if now i go to first filter drop down same issue is for that filter arise

May be**
column .search(val ? '^' + val + '$' : '', true, false ._draw();

.draw() ,,, it draw only for filtered record not all record(in back ground -- but i don't know why its working for same _column filter)

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you link to a test page showing the issue please? I can't really read the above. Information about formatting using Markdown is available here.

    Allan

  • haiderTyagihaiderTyagi Posts: 11Questions: 2Answers: 0

    Allan, sorry for that :/

    My Point is- if your td have or footer td have data in span format like
    <td align="left" style="color:Black;width:105px;"> <span id="ContentPlaceHolder1_mygdv1_lblState_12" style="color:#0033CC;">PUNJAB</span> </td>
    note-id of span changes for evry span i mean it is unique

    initComplete: function () {
    this.api().columns().every( function () {
    var column = this;
    var select = $('<select><option value=""></option></select>')
    .appendTo( $(column.footer()).empty() )
    .on( 'change', function () {
    var val = $.fn.dataTable.util.escapeRegex(
    $(this).val()
    );

                        column
                            .search( val ? '^'+val+'$' : '', true, false )
                            .draw();
                    } );
    
            column.data().unique().sort().each( function ( d, j ) {
                    select.append( '<option value="'+d+'">'+d+'</option>' )
                } );
            } );
        }
    

    value in d is(which i check by adding alert --
    <span id="ContentPlaceHolder1_mygdv1_lblState_12" style="color:#0033CC;">PUNJAB</span>

    PLEASE CHECK THAT, BY CREATING TABLe In WHICH td and tfoot HAVE span

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you link to a test case showing the issue so I can check into it please?

    Thanks,
    Allan

This discussion has been closed.