JQuery DataTable Series article (i) Usage and attributes

Source: Internet
Author: User

No more nonsense.

JQuery Datatable plugin can be downloaded to the official website

Let's talk about how to use the poke here. I'm just going to say it here. (declare that there are various classes in the HTML code, because you can use the bootstrap when you do the project)

View Code

How to invoke it in JS is as follows

View Code

To explain the usage in detail.

1 if (typeof gp.datatable! = ' undefined ' && gp.datatable! = null) {//In order to avoid multiple initialization of the DataTable () 2 3         Gp.dataTable.fnC Leartable (0); Empty data 4         gp.dataTable.fnDraw ();//Reload Data 5         //fvtable.fnadjustcolumnsizing ();//re-determine column width, actual execution and no effect 6         return; 7     }

The Showtable () method starts with the IF condition to determine if the table exists and then empties the data if it exists, and the effect is to refresh the table

Those attributes will not be said, Poke here to see here is very clear

Mainly talking about these methods

"Fnserverdata": Function (ssource, Aodata, Fncallback) {}

Dynamically bound data methods if the above code uses AJAX to return a successful value will pass into Fncallback

Look at the source code of JQ DataTable

1     /** 2      * Update the table using an Ajax call 3      *  @param {object} settings DataTables Settings object 4
   *  @returns {boolean} Block the table drawing or not 5      *  @memberof DATATABLE#OAPI 6      */7     Function
   
        {9         if (settings.bajaxdataget) {ten             settings.idraw++;             _fnprocessingdisplay (Settings, True );     _fnajaxparameters (settings), + function ); return false }23 return true;  
   

English is not very good do not translate the meaning of the line, here based on Ajax create a table step by step look down

After looking at _fnajaxupdatedraw (settings, JSON) This method gets the data to draw the table

View Code

var data = _FNAJAXDATASRC (settings, JSON); This is the way to get the data source to draw the table
Looking at _FNAJAXDATASRC (settings, JSON) this method
View Code
if (datasrc = = = ' data ') {return Json.aadata | | json[datasrc] | | json.datas;}

The above is the return data to draw the table where | | Json.datas is my add, because my backend takes a number of tables to JSON with the datas.

Here's how the C # table instantiates JSON

View Code

Finally look at the simple method of fetching numbers

Years ago did not finish, year after the completion, there is insufficient please point out, first write the article.

The main point here is the details of the use of ASP.

JQuery DataTable Series article (i) Usage and attributes

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.