Incorrect option values - Individual column searching (select inputs)

Incorrect option values - Individual column searching (select inputs)

stemiestemie Posts: 4Questions: 1Answers: 0
edited May 2015 in Free community support

Hello,

The select inputs on my table are being muddled as I have an <a href=""> link in my table cell.
This is what is being generated by datatables for the option:<option value="<a href=" "="" id="horse" data-reveal-id="myModal">Kings Gold"&gt;Kings Gold</option> as you can see it is including the links.

and this is what my code looks like <td data-label="horse"><a href="" id="horse" data-reveal-id="myModal">'.$v->horsename.'</a></td>

How can I ignore the <a href=""> so it just displays the table cell value and hence it works correctly?

I'm using the code from the page: https://datatables.net/examples/api/multi_filter_select.html

`$(document).ready(function() {
$('#example').DataTable( {
    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>' )
            } );
        } );
    }
} );
} );`

Answers

  • aproxiaaproxia Posts: 1Questions: 0Answers: 0
    edited September 2015

    I have the same issue. Here is a snippet of my code:

    var Program= 'http://flexsysqual:9000/Test%20Phase%20Readiness?Program=';                           
                                        document.write(
                                        "");
                                        for (i=0;i");
                                            try { document.write(x[i].getElementsByTagName("Program")[0].childNodes[0].nodeValue.link(Program + x[i].getElementsByTagName ("Program")[0].childNodes[0].textContent)); } catch(e){};  
                                            document.write("")
    

    The column selector pulldown shows me the Element+ "> +Element

    For example, if my element is 'BRIsat', the pulldown will show me 'BRIsat">BRIsat'.

    Most frustratingly, it will NOT find the item I am filtering because there is to item by that name.

    Any help would be much appreciated.

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    You can use my yadcf for column filters, it got quite a powerfull parsing abilitys of column cells, see example on the last column in the showcase and read about the column_data_type and html_data_type in the docs

This discussion has been closed.