data-order data-search not working correctly on search

data-order data-search not working correctly on search

AniketBhadaneAniketBhadane Posts: 2Questions: 2Answers: 0
edited August 2015 in Free community support

I have table whose tbody is binded with a knockout js observable array:

<table id="tableExt">
    <thead>
        <tr>
            <th>Extended Property Id</th>
            <th>Extended Property Name</th>
            <th>Default Value</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th>Extended Property Id</th>
            <th>Extended Property Name</th>
            <th>Default Value</th>
        </tr>
    </tfoot>
    <tbody data-bind="foreach: TestCaseExtendedProperties">
        <tr>
            <td data-bind="text: TestCaseExtendedPropertyId"></td>
            <td data-bind="attr: {'data-search': TestCaseExtendedPropertyName()}, attr: {'data-order': TestCaseExtendedPropertyName()}"><input data-bind="attr: {value: TestCaseExtendedPropertyName}" /></td>                        
            <td data-bind="attr: {'data-search': DefaultValue()}, attr: {'data-order': DefaultValue()}"><input data-bind="attr: {value: DefaultValue}" /></td>
        </tr>
    </tbody>
</table>

I have applied Datatable to the table as:

// Setup - add a text input to each footer cell
$('#tableExt tfoot th').each(function () {
    var title = $('#tableExt thead th').eq($(this).index()).text();
    $(this).html('<input type="text" placeholder="Search ' + title + '" />');
});

var table = $('#tableExt').DataTable( {
            "columnDefs": [{
                "targets": 0,
                "visible": true,
            }]
        });

// Apply the search
table.dt.columns().every(function () {
    var that = this;

    $('input', this.footer()).on('keyup change', function () {
        that
            .search(this.value)
            .draw();
    });
});

I have added search input box to each column to do individual column searching

And applied data-search and data-order to two fields:

1) TestCaseExtendedPropertyName in Extended Property Name column

2) DefaultValue in Default Value column

Searching values in [Extended Property Name] column in datatables works fine, but searching values in [Default Value] column does not work and says No matching records found

Where am I going wrong?

This discussion has been closed.