---
title: "datatables 使用"
author: "boyatec"
date: "2010-08-09T13:57:20Z"
tags: []
categories: ["Web前端"]
slug: "datatables"
draft: false
lastmod: "2010-08-09T13:57:20Z"
id: 732887
url: "https://boyatec.iteye.com/blog/732887"
---

Type Name Info int iDisplayStart Display start point int iDisplayLength Number of records to display int iColumns Number of columns being displayed (useful for getting individual column search info) string sSearch Global search field boolean bEscapeRegex Global search is regex or not boolean bSortable\_*(int)* Indicator for if a column is flagged as sortable or not on the client-side boolean bSearchable\_*(int)* Indicator for if a column is flagged as searchable or not on the client-side string sSearch\_*(int)* Individual column filter boolean bEscapeRegex\_*(int)* Individual column filter is regex or not int iSortingCols Number of columns to sort on int iSortCol\_*(int)* Column being sorted on (you will need to decode this number for your database) string sSortDir\_*(int)* Direction to be sorted - "desc" or "asc". *Note that the prefix for this variable is wrong in 1.5.x where iSortDir\_(int) was used)* string sEcho

Information for DataTables to use for rendering

 

发送到server中的data字段

In reply to each request for information that DataTables makes to the server, it expects to get a well formed JSON object with the following parameters.

Type Name Info int iTotalRecords Total records, before filtering (i.e. the total number of records in the database) int iTotalDisplayRecords Total records, after filtering (i.e. the total number of records after filtering has been applied - not just the number of records being returned in this result set) string sEcho An unaltered copy of sEcho sent from the client side. This parameter **will change with each draw** (it is basically a draw count) - so it is important that this is implemented. Note that it **strongly recommended for security reasons** that you 'cast' this parameter to an integer in order to prevent Cross Site Scripting (XSS) attacks. string sColumns Optional - this is a string of column names, comma separated (used in combination with [sName](http://boyatec.iteye.com/usage/columns#sName)) which will allow DataTables to reorder data on the client-side if required for display array array mixed aaData The data in a 2D array

返回页面的数据(.JSON)