A simple instance jumps to a specified Page Based on Datatables, and jumps to an instance based on datatables

Source: Internet
Author: User

A simple instance jumps to a specified Page Based on Datatables, and jumps to an instance based on datatables

Because the project uses Datatables to find that you cannot jump to a specified page when the page is too large, you have added the # Ables jump to a specified page # function by yourself. The implementation code is as follows:

Table = $ ('# user-table '). dataTable ({"bAutoWidth": false, "processing": true, "serverSide": true, "bStateSave": true, "pagingType": "full_numbers", "order ": [[0, 'asc '], "ajax": get_users, "oLanguage": {"sUrl": "/js/advanced-datatable/lang/Chinese. json "}," drawCallback ": function (settings) {if ($ ('body '). height () <document.doc umentElement. clientHeight) {comment ('footer'character .css ('position', 'fixed');} else {comment ('footer'character .css ('position', 'static ');} if (sla_type = 1) {table. api (). column (4 ). visible (false);} else {table. api (). column (4 ). visible (true);} // core implementation: it cannot be placed in the initComplete method, because the jump function disappears if (table. api () .page.info (). pages> 1) {$ ("# dynamic-table_info "). append ('<div class = "jump-page"> jump to <input type = "number" id = "jump_page" min = "1"> page </div> '); }}, "initComplete": function (settings, json) {if ($ ('body '). height () <document.doc umentElement. clientHeight) {comment ('footer'character .css ('position', 'fixed');} else {comment ('footer'character .css ('position', 'static ');} $ ('. adv-table input [type = "search"] '). addClass ('form-control');}, "rowCallback": function (row, data) {$ ('td: eq (0) ', row ). attr ('title', 'Role permission: '+ data [11]) ;},}); // Ables jumps to the specified page $ ("body "). delegate ('# jump_page', 'keyup', function (event) {var page = Number ($ (this ). val (); if (event. keyCode = 13 & page> 0) {table. api (). page (page-1 ). draw (false );}});

The above simple example of redirecting to a specified Page Based on Datatables is all the content shared by xiaobian. I hope to give you a reference and support for the customer's house.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.