Use of jquery DataTables form plug-in (Web page data table and pagination display)

Source: Internet
Author: User

DataTables-Very powerful jQuery form plugin, variable width page view, live filter.

Multi-column sorting, automatic probing of data types, smart column widths, and data acquisition from almost any data source.

So how to use the DataTables under bootstrap:

Just use the HTML or EJS to refer to the written stylesheet CSS and script file js, the corresponding code is as follows:

1 <Head>2     <Linkhref= "Http://apps.bdimg.com/libs/bootstrap/3.0.3/css/bootstrap.min.css"rel= "stylesheet">3     <Scriptsrc= "Http://apps.bdimg.com/libs/jquery/2.0.0/jquery.min.js"></Script>4     <Scriptsrc= "Http://apps.bdimg.com/libs/bootstrap/3.0.3/js/bootstrap.min.js"></Script>5     <Linkrel= "stylesheet"href= "Http://cdn.datatables.net/1.10.4/css/jquery.dataTables.css"></style>6     <Scriptsrc= "Http://cdn.datatables.net/1.10.4/js/jquery.dataTables.js"></Script> 7     <Scriptsrc= "Http://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></Script> 8     <Script>9 $ (document). Ready (function(){Ten     $('#example'). dataTable (); One     }); A     </Script> -     <MetaCharSet=utf-8 "> -     <title><%=title%></title> the   </Head> -   <Body> -    <Divclass= "Table-responsive"> -    <TableID= "Example"class= "Display table table-bordered table-striped table-hover"width= "100%">

The 5th line is to establish the relationship with the external resource jquery DataTables;

6th, Line 7 is the script file that loads jquery separately datatables.js and dataTables.min.js

Line 8-11 reads table from jquery and displays the results on the page.

The mistake I made in this process was in line 5th, and I wrote link as a 6,7 script, which didn't get the result I wanted,

Later, the difference between link and script was realized by querying the data:

<link> tags define the relationship between documents and external resources <link> tags are often used to link to style sheets;

<style> tags define the HTML document's style file reference address <style> element you need to specify a style file to render the HTML document.

In this way it is impossible to get the desired style without creating a style sheet.

jquery DataTables Table Plug-in Usage (Web page data table and pagination display)

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.