最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jQuery EasyUI表格中添加搜索功能
时间:2022-06-25 17:25:53 编辑:袖梨 来源:一聚教程网
创建数据网格
创建具有分页功能的数据网格,然后将工具栏添加到其中。
title="Load Data" iconCls="icon-save"
rownumbers="true" pagination="true">
工具栏定义为:
当用户输入搜索值并点击搜索按钮时,“doSearch”函数将会被调用:
function doSearch(){
$('#tt').datagrid('load',{
itemid: $('#itemid').val(),
productid: $('#productid').val()
});
}
上面的代码调用了“load”方法来加载新的数据网格(datagrid)数据。我们需要传递“itemid”和“productid”参数到服务器。
include 'conn.php';
$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
$itemid = isset($_POST['itemid']) ? mysql_real_escape_string($_POST['itemid']) : '';
$productid = isset($_POST['productid']) ? mysql_real_escape_string($_POST['productid']) : '';
$offset = ($page-1)*$rows;
$result = array();
$where = "itemid like '$itemid%' and productid like '$productid%'";
$rs = mysql_query("select count(*) from item where " . $where);
$row = mysql_fetch_row($rs);
$result["total"] = $row[0];
$rs = mysql_query("select * from item where " . $where . " limit $offset,$rows");
$items = array();
while($row = mysql_fetch_object($rs)){
array_push($items, $row);
}
$result["rows"] = $items;
echo json_encode($result);
相关文章
- 洛克王国世界虫队怎么打 虫队打法教学 11-05
- 洛克王国世界服装积分卡怎么获得 服装积分卡获取攻略 11-05
- 洛克王国世界音速犬在哪 音速犬具体位置 11-05
- 星塔旅人特丽莎值得培养吗 特丽莎角色强度介绍 11-05
- 洛克王国世界蹦蹦果怎么打 蹦蹦果打法教学 11-05
- 二重螺旋妮弗尔夫人怎么配队-妮弗尔夫人阵容搭配推荐 11-05
