jquery-datatables

Uncaught TypeError: Cannot read property 'aDataSort' of undefined

倖福魔咒の 提交于 2019-11-29 07:05:11
i am working on pagination and i am using DataTables plugin , on some tables it's work but on some tables it gives error: Uncaught TypeError: Cannot read property 'aDataSort' of undefined my page script looks like: $(document).ready(function() { $('.datatable').dataTable( { "scrollY": "200px", "scrollCollapse": true, "info": true, "paging": true } ); } ); //HTML code <table class="table table-striped table-bordered datatable"> <thead> <tr> <th><?php echo lang('date_label')?></th> <th><?php echo lang('paid_label')?></th> <th><?php echo lang('comments_label');?></th> </tr> </thead> <tbody> <?php

jQuery DataTables - Accent-Insensitive Alphabetization and Searching

邮差的信 提交于 2019-11-29 06:01:15
When using jQuery DataTables is it possible to do accent-insensitive searches when using the filter? For instance, when I put the 'e' character, I'd like to search every word with 'e' or 'é', 'è'. Something that came to mind is normalizing the strings and putting them into a separate, hidden column but that wouldn't solve the alphabetizing issue. EDIT I tried the following: $.fn.dataTableExt.ofnSearch = function ( data ) { return ! data ? '' : typeof data === 'string' ? data .replace( /\n/g, ' ' ) .replace( /á/g, 'a' ) .replace( /é/g, 'e' ) .replace( /í/g, 'i' ) .replace( /ó/g, 'o' ) .replace(

how to pass parameters on reload of datatables

て烟熏妆下的殇ゞ 提交于 2019-11-29 03:06:38
问题 I have a datatable that I initialize like this: mytable = DataTable({ ajax:{ url: "/url/getTableData", dataSrc: "" }, sortClasses: false, paging: false, scrollY: 300, columns: cols }); later I'd like to do mytable.ajax.reload(); It works fine, but now I'd like to send a few parameters in that request. Those parameters I only need on reload, and not in the initialization of the table. How do I do that? thank you! 回答1: Option 1 - Use the preXhr.dt event. table = $('#example') .on('preXhr.dt',

Retrieving row data after filtering JQuery Datatables

筅森魡賤 提交于 2019-11-29 00:40:38
问题 Seems like it should be easy but... Does anyone know how to return the current rows from a filtered dataTable? The oTable.fnGetNodes() method returns all rows, where I just want the filtered (visible, but including paginated) ones // filter on division var oTable = $('#summary-table').dataTable(); oTable.fnFilter(division_text, 2, true); // Get the nodes from the table var nNodes = oTable.fnGetNodes(); // <-- still retrieves original list of rows I checked: Retrieving visible data from

Model binding new Datatables 1.10 parameters

爷,独闯天下 提交于 2019-11-29 00:07:58
问题 In Datatables 1.10 the ajax server side parameters changed from public class DataTableParamModel { public string sEcho{ get; set; } public string sSearch{ get; set; } public int iDisplayLength{ get; set; } public int iDisplayStart{ get; set; } public int iColumns{ get; set; } public int iSortingCols{ get; set; } public string sColumns{ get; set; } } to (API Here http://datatables.net/manual/server-side) columns[i][data] columns[i][name] columns[i][orderable] columns[i][search][regex] columns

Understanding fnServerData in Datatables

房东的猫 提交于 2019-11-28 23:59:12
I am trying to use Datatables in my project. I want to understand the use of "fnServerData" callback option. I have gone through the doc Here and have seen following example code - $(document).ready( function() { $('#example').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "xhr.php", "fnServerData": function ( sSource, aoData, fnCallback, oSettings ) { oSettings.jqXHR = $.ajax( { "dataType": 'json', "type": "POST", "url": sSource, "data": aoData, "success": fnCallback } ); } } ); } ); What is "sSource", "aoData" parameters here and how we are supplying values in it? Also

How to loop through all rows in DataTables jQuery?

放肆的年华 提交于 2019-11-28 22:38:08
问题 I am using jquery plugin D ataTables for building nice table var table = $('#example').DataTable({ "data": source }); I would like that make an each for all rows in table Unfortunately this way may be out of date and does't work with new version (it launchs an error) $(table.fnGetNodes()).each(function () { }); And this way only works only for visibles rows (10 first rows because other rows are paginated) table.each( function ( value, index ) { console.log( 'Data in index: '+index+' is: '

Correctly Suppressing Warnings in DataTables?

扶醉桌前 提交于 2019-11-28 20:59:15
问题 I'm trying to correctly suppress warnings (alerts) in DataTables. The standard behavior of DataTables is to throw a javascript alert when an error occurs; however, this is currently inconvenient for me. I have been trying to convert the warning to a javascript error by $.fn.dataTableExt.sErrMode = 'throw'; Which works correctly, but this stops the current javascript execution, which is not what I want. So, I wrapped the DataTables operations (init and changes) in a try-catch with no error

Specifying a fixed column width in jQuery Datatables

馋奶兔 提交于 2019-11-28 20:50:48
I'm trying to specify a fixed width for a few columns in a jQuery datatable. I've attempted to accomplish this via the column definitions specified in the datatables documentation , but the column and column header still get auto-sized. Here's the jsFiddle I've been working with: jsFiddle JavaScript: var table = $('#example2').DataTable({ "tabIndex": 8, "dom": '<"fcstTableWrapper"t>lp', "bFilter": false, "bAutoWidth": false, "data": [], "columnDefs": [ { "class": 'details-control', "orderable": false, "data": null, "defaultContent": '', "targets": 0 }, { "targets": 1}, { "targets": 2, "width":

jQuery DataTables Filtering for Specific Columns Only

非 Y 不嫁゛ 提交于 2019-11-28 20:09:46
问题 I am using the jQuery plugin DataTables (http://datatables.net) for pagination, search capabilities and filtering. There is a filter function (http://datatables.net/release-datatables/examples/api/multi_filter_select.html) that places form select elements for each column. My issue is that I don't want the filter select elements for every column, only some. I've modified the original code as I want Yes/No filtering only, and my first column contains user names. How do I remove the form select