Book Image

PHP Ajax Cookbook

Book Image

PHP Ajax Cookbook

Overview of this book

Table of Contents (16 chapters)
PHP Ajax Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Displaying data in a grid


In Web 2.0 sites, the term "data grid" usually means a spreadsheet-/MS Excel-like display using HTML tables. Data grids provide usability and easy access to data for users. Some common features of data grids are:

  • Ability to paginate data

  • Ability to sort columns

  • Ability to sort rows

  • Ability to quickly search or filter data fields

  • Ability to have frozen/fixed rows or headers

  • Ability to have frozen columns or headers

  • Ability to highlight any column of interest

  • Ability to load from different data sources, such as JSON, JavaScript array, DOM, and Hijax

  • Ability to export data to different formats

  • Ability to print formatted data

Getting ready

We'll require the DataTables jQuery plugin from http://datatables.net/, along with jQuery core. Based on our requirement, we may sometimes require additional plugins.

How to do it...

In a simple implementation (without using any other data sources), it is enough to display the data in an HTML table. DataTables, without any plugins and additional...