首页 > PHP资讯 > PHP培训技术 > 快速的jQuery插件和PHP表格生成器 Watajax

快速的jQuery插件和PHP表格生成器 Watajax

PHP培训技术

Watajax 是一个PHP和jQuery结合起来用来快速生成网页表格数据的解决方案。

示例代码:

PHP:
<?php
  // Connect to the database first if you plan on using the Sql version of Watajax.

  require_once("lib/Watajax.class.php");
  $Watajax = new WatajaxSql();
  $Watajax->columns = array(
    "id" => array("name" => "#", "sort_type" => "numeric", "hide" => true),
    "firstname" => array("name" => "First name", "transform" => '<img src="'.URI.'/images/icons/vcard.png" valign="absmiddle" /> !firstname'),
    "lastname" => array("name" => "Last name"),
    "email" => array("name" => "E-mail adress", "transform" => '<a href="show_reciptient.php?id=!id">!email</a>'),
    "tools" => array("name" => "", "virtual" => true, "transform" => '<a href="edit.php?id=!id">edit</a>'));
  $Watajax->run();
?>

jQuery:
<script type="text/javascript">
  $(document).ready(function() {
    $("#watajax_table").watajax({ajax_connector:"ajax.php", table_id: "contacts"});
  })
</script>

本文由欣才IT学院整理发布,未经许可,禁止转载。