How to provide just the search box initially then load the Datatable records after user input data

How to provide just the search box initially then load the Datatable records after user input data

riaria Posts: 2Questions: 1Answers: 0

I am new to this plugin . I want to initially display the search box without datatable loading any records.
when the user inputs the data in search box the the DT should show up the with corresponding records. Is this possible ?

Thank you,
Ria

Answers

  • rhinorhino Posts: 80Questions: 2Answers: 17

    Does the data need to be sent from a server once the user inputs the search, or is all the data present when the page loads, and just hidden?

  • riaria Posts: 2Questions: 1Answers: 0

    Hi Rhino,

    Thank you for your response.The Data is present when the page loads. below is the script I am using for basic filtering and displaying of my data in DT.

    $(document).ready(function() { var shilpatable = $('#example').dataTable( { "ajax": { "url": "jsondataset.txt", "dataSrc": "" }, "columns": [ { "data": "Name" }, { "data": "URL" }, { "data": "Views" }, { "data": "Type" } ], "aoColumnDefs": [ { "aTargets": [ 0 ], "mData": "Name", "width": "50%", "background-color":"white", "mRender": function (data, type, row) { return '' + row.Name + '';} }, { "targets": [ 2 ], "visible": false, "searchable": false }, { "targets": [ 1 ], "iDeferLoading": 840, "visible": false, "searchable": false } ], "iDisplayLength": 10, "oLanguage": { "sSearch": "Keyword " } } ); $("'#global_filter").on( 'keyup click', function () { filterGlobal(); } ); $("#tabs").tabs( { "activate": function(event, ui) { $( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust(); } } ); $("ul.dropdownmenu").superfish({ autoArrows: false, speed: 'fast', delay: 0 }); } );
This discussion has been closed.