jquery-datatables

How to refresh a simple Datatables table when adding new rows with jQuery

我是研究僧i 提交于 2019-12-07 07:22:49
问题 I thought this one would be simple, but I can't find a reference that is not about ajax loaded data or data supplied in an array. I am using DataTables on an existing HTML table with this basic code: $('table.wizard').dataTable({ lengthChange: false, iDisplayLength: 100, order: [[9, 'desc']] }); I am adding rows to a table, dynamically, as data records are found like this: var $body = $('table.wizard tbody'); $tr = $("<tr>").appendTo($body).attr({ 'id': 'sku' + item.MerchantSKU, 'data-sku':

JQuery1.8 Datatables saving state on click of a button

谁都会走 提交于 2019-12-07 06:05:27
问题 I have a jsp with a table and two buttons "home" and "back" in it and have imported jquery.datatable.js in it. On click of "home" the page should load without any pagination or filter saved. and on click of "back" the table should have all the filter and pagination saved. I have tried setting the "bStateSave" flag true while initializing the data table. This always loads the table with the filter and pagination. Is there any way I can load the table with saved state on click of "back" button

jQuery datatables Twitter/facebook style paging

霸气de小男生 提交于 2019-12-07 05:32:18
问题 I have been searching around for a good resource on how to do this with no luck. I am using the jQuery datatables plugin with serverside processing along with pipelining enabled(example). I have this working in my asp.net webforms project and will be moving to MVC for future projects. I am taking care of server side processing with the class found Here. I have also been looking through the article found Here related to the pagination. Basically what I need to do is create this type of

DataTables plug-in - Display scrollbar below tfoot tag?

旧城冷巷雨未停 提交于 2019-12-07 04:17:02
问题 I use jQuery DataTables plug-in and "scrollX":true for horizontal scrolling. Why scroll bar appears above tfoot tag? How to make it appear below footer? var table = $('#example') .DataTable( { "scrollX": true, "scrollCollapse": true, "dom": 'Zlrtip', "colResize": { "tableWidthFixed": false, //"handleWidth": 10, "resizeCallback": function(column) { } }, "searching": false, "paging": false, "info": false, "deferRender": true, "sScrollX": "190%" }); See JSFiddle example demonstrating the problem

jQuery Datatables: how to delete the row

拥有回忆 提交于 2019-12-07 04:09:51
问题 I want to delete the row from datatable. Here is the datatables code I use: var aSelected = []; oTable = $('.itemPublished').dataTable({ "bJQueryUI": true, "sPaginationType": "full_numbers", "bServerSide": true, "bProcessing": true, "sAjaxSource": "/item/datatable", "bDeferRender": true, "iDisplayLength":20, "aLengthMenu": [[10, 20, 50, 75, 100, 150], [10, 20, 50, 75, 100, 150]], "aoColumnDefs": [ { "bSortable": false, "aTargets": [ 2, 3, 4 ] }, { "sClass": "left", "aTargets": [ 1 ] } ],

Put a class depending on the data ajax datatables

情到浓时终转凉″ 提交于 2019-12-06 16:19:29
I searched alot and I'm extremely sure it can be done easily but I cannot find a way to do it. So I use jQuery DataTables and I'm trying to generate a class and do a few javascript action depending on the value I'm recieving. For example, something as simple as putting a red background when the unit is negative, etc. I already created my CSS for this and now I'm loading a JSON file via the ajax parameters of DataTables. Here's my javascript: table = $('#activitiesTable').DataTable({ "ajax": "data.txt", "columns": [ { "data": "id" }, { "data": "description" }, { "data": "type_of_expenditure" },

Auto refresh DataTables table with reloading the whole page

☆樱花仙子☆ 提交于 2019-12-06 15:04:29
问题 Is anyone able to guide on how to refresh datatables datas in every 1min interval without reloading the entire page. This is my code: $(document).ready( function () { var refreshTable = $('#id_css').DataTable({ "sAjaxSource": 'ajax/alert_data.txt', "bServerSide": true, "iDisplayLength": 100, "bFilter": false, "aaSorting" : [[2, "desc"]], "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { if ( aData[2] == "5" ) { $('td', nRow).css('background-color', 'Red'); } else if

DataTables detail row without nesting

别等时光非礼了梦想. 提交于 2019-12-06 11:06:39
I'm trying to make a table with nested data inside. I want to have one set of column headers at the top of the table and have them carry through the entire table. To this end, I've started adapting the Row Details example for my needs. The code: var table = this.$el.attr({ 'width': '100%', 'class': 'table table-striped table-hover' }).DataTable({ data: data, autoWidth: true, paging: false, order: [[0,'asc']], columns: [ { 'width':15, 'class':'details-control', 'orderable':false, 'data':null, defaultContent: '+' }, {data:'term',title:'Item ID'}, {data:'count',title:'Count'} ] }); this.$el.find(

How to get an hidden column value in mRender() function from ajax data source in jQuery datatable

不想你离开。 提交于 2019-12-06 11:04:12
I am trying to create a jQuery datatable from a ajax source in asp.net mvc5. I want to add an extra column for edit and delete which is not in my model class or in ajax data-source.For the edit and delete functionality I need the value of the Id column which I have not shown in my datatable. Here is my Model class: public class Country { public int Id { get; set; } [Required(ErrorMessage = "Country Code Name Must not be empty")] public String Code { get; set; } [Required(ErrorMessage = "Country Name Must not be empty")] public String Name { get; set; } [Required(ErrorMessage = "Template Name

How do I draw Excel-style data bars in a jQuery DataTable?

喜你入骨 提交于 2019-12-06 10:41:25
问题 I'm looking to add data bars behind values in a selected column of a jQuery DataTables table, like the Data Bars Conditional Formatting option in Excel. This answer shows a solution of how to achieve this sort of thing with jqGrid. How would I achieve a similar effect in DataTables? 回答1: Should be pretty easy, using fnRowCallback(). I don't have my sample code onhand, but suffice it to say that if you use the example on datatables.net for fnRowCallback, you can use the data value to create a