Search
11364 results 2051-2060
Forum
- 1st Feb 2018Hi can someone please help me with this situation about datatables and date range filter by RadCorpcurrently I'm using a Ajax for my data to be loaded/fetch in my datatable my problem is that when i tried to run my code the datatable is not showing up even though it is being catch in the console.log that i've used for testing purpose. and it is not working even though there is no error in the code that I'm using :( $(document).ready(function() { var table = $('#example').DataTable( { "ajax": "js/datatables/datatableAdminGenerateFullReport.json", "columns": [ { "mData": "ID #" }, { "mData": "Name" }, { "mData": "Transaction Date" }, { "mData": "Transaction ID"}, { "mData": "Currency" }, { "mData": "Amount" }, { "mData": "Source"}, { "mData": "Status"} ], dom: 'Bfrtip', lengthChange: false, buttons: [ { extend:'copyHtml5', text: '', titleAttr: 'Copy', messageTop: 'The information in this table is copyright to AU Remit.' }, { extend: 'excelHtml5', text: '', titleAttr: 'Excel', messageTop: 'The information in this table is copyright to AU Remit.' }, { extend: 'pdfHtml5', text: '', titleAttr: 'PDF', textAlign: 'center', messageBotom: 'The information in this table is copyright to AU= Remit.' }, { extend: 'colvis' } ] }); table.buttons("#example_filter").container().insertAfter('#example_filter'); }); $("#min, #max").keyup( function(){ table.draw(); }); $.fn.dataTable.ext.search.push( function( settings, data, dataIndex ){ console.log("hello"); var arr_min = parseInt($("#min").val()); var arr_max = parseInt($("#max").val()); var arr_date = parseFloat(data[2]) || 0; var iMin = new Date(Date.parse(arr_min)); var iMax = new Date(Date.parse(arr_max)); var iDate = new Date(Date.parse(arr_date)); if (iMin == "" && iMax == "") { return true; } else if (iMin == "" && iDate <= iMax) { return true; } else if (iMin <= iDate && "" == iMax) { return true; } else if (iMin <= iDate && iDate <= iMax) { return true; } return false; } );
- 21st Jan 2018how to get case data value in dropdown filter'''$(document).ready(function () { $.ajax({ url: 'StudentService.asmx/GetStudents', method: 'post', dataType: 'json', success: function (data) { $('#datatable').on('processing.dt', function (e, settings, processing) { $('#processingIndicator').css('display', processing ? 'block' : 'none'); }) .DataTable({ initComplete: function () { this.api().columns([3,4]).every(function() { var column = this; var select = $('<select><option value="">ALL</option></select>') .appendTo( $(column.header()).empty() ) .on( 'change', function () { var val = $.fn.dataTable.util.escapeRegex( $(this).val() ); column .search( val ? '^'+val+'$' : '', true, false ) .draw(); } ); column.data().unique().each( function ( d, j ) { select.append( '<option value="'+d+'">'+d+'</option>' ) } ); } ); }, paging: true, sort: true, searching: true, scrollY: 450, scrollX: 1800, "lengthMenu": [[19, 25, 50], [19, 25, 50]], columnDefs: [{ type: "salary-grade", targets: [3], orderData: [3, 4, 1], }], order: [[3, "asc"]], data: data, columns: [ { 'data': 'id' }, { 'data': 'name' }, { 'data': 'fname' }, { 'data': 'CLASS' }, { 'data': 'section' }, { 'data': 'contact', 'sortable': false, 'searchable': false }, { 'data': 'sex', 'render': function (data, type, row) { switch (data) { case 'Male': return 'free'; break; case 'Female': return 'paid'; break; default: return 'N/A'; } } }, { 'data': 'dob', 'render': function (jsonDate) { var date = new Date(parseInt(jsonDate.substr(6))); var month = date.getMonth() + 1; return date.getDate()+"-" + month + "-" + date.getFullYear(); } }, { 'data': 'address' }, { 'data': 'admdate', 'render': function (jsonDate) { var date = new Date(parseInt(jsonDate.substr(6))); var month = date.getMonth() + 1; return date.getDate()+"-" + month + "-" + date.getFullYear(); } }, { 'data': 'session', 'render': function (data, type, row) { switch (data) { case '1015': return '2017-18'; break; case '1016': return '2018-19'; break; default: return 'N/A'; } } }, { 'data': 'type', 'render': function (data, type, row) { switch (data) { case 'True': return 'Old'; break; case 'False': return 'New'; break; default: return 'N/A'; } } } ] }); } }); }); </script>'''
- 4th Jan 2018How to set a default value in the multi filter select?Hello! I'd like to set a default value in one of the camps of the multi-filter select (https://datatables.net/examples/api/multi_filter_select.html) I'd also like to set the default searchbar text to said value. Is it possible to do both? Thanks!!!
- 8th Dec 2017How to Filter the bootstrap DataTable with Daterange on Date column and text columnI am using bootstrap datatable with date column and more than one text columns. I want to apply filters on date column(Daterange) and text column on button click event. The table also have paging also.
- 21st Oct 2017Cannot customize Search Box and Filter Box with css class when translatingHi, When I use translation the customization on both fiedls stop working. Can someone help me? This is my code: $(document).ready(function () { $.ajax({ url: "Default.aspx/generateData", type: "POST", dataType: "json", contentType: "application/json; charset=utf-8", success: function (retorno) { $('#myTable').DataTable({ data: JSON.parse(retorno.d), dom: "<'row'<'col-sm-6'l><'col-sm-6'f>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", language: { url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/Portuguese-Brasil.json' }, createdRow: function (row, data, dataIndex) { if ((data['dtencerramentoalerta'] == null) || (data['dtencerramentoalerta'] == '')) { $(row).addClass("danger"); } else { $(row).addClass("warning"); } }, order: [[ 2, "desc" ]], columnDefs: [ { className: "text-center", "targets": [0, 1, 2, 3, 4] }, { orderable: false, "targets": [4] } ], columns: [ { 'data': 'column1' }, { 'data': 'column2' }, { 'data': 'column3' }, { 'data': 'column4' }, { 'data': null, 'fnCreatedCell': function (nTd, sData, oData, iRow, iCol) { $(nTd).html("<a href=test.aspx?data=" + oData.column5+ "><i class=\"fa fa-area-chart fa-fw\"></i></a>"); }, 'bSearchable': false } ] }); }, complete: function () { $('div.dataTables_filter input').addClass("form-control"); $('div.dataTables_filter input').addClass("input-sm"); $('div.dataTables_length select').addClass("form-control"); $('div.dataTables_length select').addClass("input-sm"); } }); }); If I remove the following lines the css classess are applied successfully: language: { url: 'https://cdn.datatables.net/plug-ins/1.10.16/i18n/Portuguese-Brasil.json' }, Cheers
- 25th Sep 2017Way to retain individual column filter after table refresh after updateHi, I have used multi-select drop-down for individual column filtering. I am updating data of table and reloading table again but it loses its selected values after that. Is there any way to retain this drop-down selection?
- 19th Aug 2017How to order and filter asyncwhile it's doing it's filtering. So the way i
- 30th Jun 2017Filter and bind the data to the DatatableHello all, I am binding the Large unsorted object data to datatable. My code is below: var ExpenceDataTableElement = $('#ExpenceDataTable').DataTable({ data: Data, pageLength: 10, "bSort": false, "autoWidth": false, columns: [{ "className":"clsAction", "data": "TimesheetUID", "title": "Action", "render": (data, type, row) => '', "width": "4%", "visible":true }, { "className":"clsPeriodName", "data": "PeriodName", "title": "Timesheet Name", "visible":true }, { "className":"clsTSPeriodStatus", "data": "Open", "title": "Timesheet Period Status", "render":function(data,type,row){ if(data == 1){return " Open"}else{return " close"}}, "width": "10%", "visible":true } ], "oLanguage": { "sEmptyTable": "No Records found." } }); The data contains more than 15 thousands of records, it contains the flag like 'Open' OR 'Close'. Currently I am using the for loop to sort the data and bind it to the data - table. Means if data have 15 thousand of records and it contains 7 thousands of 'Open' flag records, it takes long time to sort & bind the data to Datatable. Hence Is there any way to check the condition in 'columns:' if flag is not 'Open' then continue to the next iteration??
- 27th Jun 2017Filter when users selects empty and some valuei am using column filters. I have created my
- 18th Jun 2017Decimal column filtering and column name filter problemstextbox there is no filtering and datatables shows all