Examples
下面是PHP中生成的表页:
<p><a href=”<?=%20$this->url(array(‘controller’=>’contact’,%20
‘action’=>’add’));?>”>Add new Contact</a></p>
<table class=”contactTable” id=”contactTable”>
<thead>
<tr>
<th class=”sortable”>Contact</th>
<th class=”sortable”>Address</th>
<th class=”sortable”>Phone Number</th>
<th class=”sortable”>Email</th>
<th> </th>
</tr>
</thead>
<tbody>
<?php foreach($this->contacts as $contact) { ?>
<tr>
<td><?= $this->escape($contact->name);?></td>
<td><?= str_replace(array(“n”, “n”, “n”, “nr”, “nr”, “nr”, “r”, “r”, “r”), ‘ ‘, $this->escape($contact->address));?></td>
<td><?= $this->escape($contact->phone_number);?></td>
<td><?= $this->escape($contact->email);?></td>
<td>
<a href=”<?=%20$this->url(array(‘controller’=>’contact’,%20
‘action’=>’edit’,%20’id’=>$contact->id));?>”>Edit</a>
<a href=”<?=%20$this->url(array(‘controller’=>’contact’,%20
‘action’=>’delete’,%20’id’=>$contact->id));?>”>Delete</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
jQuery
jQuery的方法是使用tablesorter插件。 它是一个函数与几个配置参数以下的代码:
<?php // adding scripts
$headScript = ‘
$(function(){
$(“table”).tablesorter({
sortList: [ [0,0] ],
widgets: [’zebra’],
// pass the headers argument and assign an object
headers: {
// assign the fifth column (we start counting zero)
4: {
// disable it by setting the property sorter to false
sorter: false
}
}
});
});
‘
$this->headScript()->appendFile(‘/js/jquery.tablesorter.js’)
->appendScript($headScript); ;
?>
注:headScript()业务是一个Zend框架的事情,所以你可以控制哪些JavaScript以显示在每一页上。
Ext JS
该分机 js中 的方法是一个比较复杂。 您创建一个数据存储,定义创建网格(表内存),然后添加数据,并重新渲染的东西。 下面是代码:
<?php // adding scripts
$headScript = ”
$(document).ready(function(){
$(‘#wheelink’).bind(‘click’,function() {










