datatables-1.10

Alert the page no. on jQuery dataTables page change event

拥有回忆 提交于 2019-12-10 03:43:55
问题 The following is working for me: $('#datatable').on('page.dt', function() { alert("changed"); }); Whenever I am changing the page,the alert is shown.But if I want to alert the page no. which is clicked then what's the way 回答1: table.page.info() returns the current pagination information. That is current page , number of pages , recordsDisplay , recordsTotal and more. var table = $('#datatable').DataTable(); $('#datatable').on('page.dt', function() { var info = table.page.info(); var page =

Populating Datatables with JSON array from GET request

╄→尐↘猪︶ㄣ 提交于 2019-12-09 16:43:33
问题 I know that there has been many answers and tutorials about populating Jquery Datatables with data but I always get to the point of getting the following exception: Uncaught TypeError: Cannot read property 'length' of undefined I, being mainly a backend developer, have little to no experience with writing client so I would like to ask you about what I am doing wrong in the following example. I have a server running locally exposing an endpoint /destination which responds with a JSON string in

DataTable serverside process how to remeber checked boxes on pagination

折月煮酒 提交于 2019-12-08 10:13:38
问题 How to remeber checked boxes values with paging. when i checked values on 3 pages. it only storing last page values and other values removing. i used below with client side processing . $('.button').click(function () { var id = ""; var oTable = $("#example").dataTable(); $(".checkboxClass:checked", oTable.fnGetNodes()).each(function () { }); }); 回答1: Check out jQuery DataTables Checkboxes extension and server-side processing example, where state of checkboxes is preserved. For example: var

Set classes for internal buttons in a table with deferred loading of data

拜拜、爱过 提交于 2019-12-08 08:01:43
问题 jquery.dataTables.min.js: DataTables 1.10.12 I need to disable export button if the status is not "success" in the DataTables like this ( deferred loading ): The code: var data_table = task_submit_table.DataTable({ "processing": true, "serverSide": true, "deferRender": true, "deferLoading": 0, "ordering": true, "order": [[ 0, "desc" ]], "ajax": { "url": "get_task_tasks/", "type": "POST", "data": function (d) { var form_data = {"ukis_project_id": ukis_proj_id.find(":selected").val(), "task

Positioning DataTables elements with DOM option

寵の児 提交于 2019-12-08 03:36:34
问题 I can't correctly position the l ength changing and the f iltering input to the top-right and bottom-left respectively on my DT::datatable output in shiny using the dom option. Code: library(shiny) library(DT) set.seed(2282018) company <- data.frame(Company = letters[1:10], Sales = scales::dollar(runif(10, 200, 1230)), stringsAsFactors = F) # UI ---- ui <- function(){ fluidPage( sidebarLayout( sidebarPanel(numericInput("nums", label = "Num Input", value = 1, min = 1, max = 10)), mainPanel

DataTables from Ajax source order-by data-order and display formatted date

眉间皱痕 提交于 2019-12-07 04:58:57
问题 Basically I want to pull data from ajax into my columns, but I want the cells in the columns to have the data-order attribute on them with the value from the ajax call and use moment.js to format the data in the cell. I'm assuming this is the best way to make it pretty AND orderable. I found the plugin for datetime-momentJS, but it will only order the date, not format it as well. var dataTable = $('#products').DataTable( { 'processing': true, 'ajax': '/products', 'columns': [ { 'data':

How to Export Multiple Row Headers in jQuery Datatables?

 ̄綄美尐妖づ 提交于 2019-12-06 14:39:22
问题 Hi I am using jQuery Datatables 1.10. I am trying to export Datatable multiple header rows but not getting.But it is Exporting only second header row.I am using Buttons buttons: [{ extend: 'excel', header: true }, { extend: 'print', header: true } ], My table Structure like <table id="example" style="color: black;" class="display compact cell-border" cellspacing="0"> <thead> <tr> <th rowspan="2">Sl.No</th> <th rowspan="2">Zone</th> <th colspan="2">Allotted</th> <th colspan="2">Vacant</th> <th

DataTables image (or at least image title) export to PDF

孤人 提交于 2019-12-06 07:44:56
问题 Using DataTables and Buttons ( NOT TableTools, which is retired) extension. Some cells have progressbars and small icons. Is there a way to export these images (or at least their titles) to PDF? Found some possible hacks on this page, but all of them were for retired TableTools. Checked https://datatables.net/reference/button/pdf and https://datatables.net/reference/api/buttons.exportData%28%29 but couldn't find any method to achieve this goal. Tested by adding this code: stripHtml: false but

DataTables from Ajax source order-by data-order and display formatted date

不问归期 提交于 2019-12-05 08:19:33
Basically I want to pull data from ajax into my columns, but I want the cells in the columns to have the data-order attribute on them with the value from the ajax call and use moment.js to format the data in the cell. I'm assuming this is the best way to make it pretty AND orderable. I found the plugin for datetime-momentJS, but it will only order the date, not format it as well. var dataTable = $('#products').DataTable( { 'processing': true, 'ajax': '/products', 'columns': [ { 'data': 'updated_at', 'className':'date' } ] }); right now I have this as the final result: <td class="date">2015-11

Alert the page no. on jQuery dataTables page change event

只谈情不闲聊 提交于 2019-12-05 05:46:08
The following is working for me: $('#datatable').on('page.dt', function() { alert("changed"); }); Whenever I am changing the page,the alert is shown.But if I want to alert the page no. which is clicked then what's the way table.page.info() returns the current pagination information. That is current page , number of pages , recordsDisplay , recordsTotal and more. var table = $('#datatable').DataTable(); $('#datatable').on('page.dt', function() { var info = table.page.info(); var page = info.page+1; alert('changed - page '+page+' out of '+info.pages+' is clicked'); }); see demo -> http:/