Javascript占位符不会在Datatables上显示结果

时间:2017-06-16 13:56:57

标签: javascript datatables

在我们使用" oLanguage" 之后,此代码会阻止它显示搜​​索结果。

原始代码块

    <script>
$(document).ready(function() {
    // Setup - add a text input to each footer cell
    $('table.table tfoot th').each( function () {
        var title = $(this).text();
        $(this).html( '<input type="text" placeholder="'+title+' ARA" />' );
    } );

    // DataTable
    var table = $('table.table').DataTable();

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

        $( 'input', this.footer() ).on( 'keyup change', function () {
            if ( that.search() !== this.value ) {
                that
                    .search( this.value )
                    .draw();
            }
        } );
    } );
} );
</script>

申请&#34; oLanguage&#34;

$(document).ready(function() {
    // Setup - add a text input to each footer cell
    $('table.table tfoot th').each(function () {
        $(this).html('<input type="text" placeholder="'+$(this).text()+' ARA" />');
    });

    // DataTable
    var table = $('table.table').DataTable({
        order: [
          [0, "desc"]
        ],
        paging: true,
        oLanguage: {
          sUrl: "js/dil/LANGUAGE.json",
        }
    });

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

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

占位符=&#34;&#39; + $(本)的.text()+&#39; ARA&#34; 有效,但它不显示搜索结果。在应用&#34; oLanguage&#34; 占位符=&#34;&#39; + title +&#39;之前ARA&#34; 工作得很好?

有什么意见吗?

0 个答案:

没有答案