php 如何配合easyui 实现,datagrid1点击某行,然后datagrid2 进行动态查询。 phpeasyuidatagrid 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个基本上Ajax的方式了。写个接口给JS调用查询数据就成了。 可以写段代码让我看看吗?我是写的datagrid的一个 onClickrow事件,但是没反应。 http://www.w3cschool.cc/jeasyui/jeasyui-datagrid-datagrid22.html这个示例不能满足你的要求吗? var url; $(document).ready(function() { $('#dg').datagrid({ onClickRow:function () { var row = $('#dg').datagrid("getSelected"); url = '../php/trade.php?o=list_pro&pid='+row.pid; $('#dg_project').datagrid('reload');// alert('pid='+row.pid); } }); });<table id="dg_project" class="easyui-datagrid" url="../php/trade.php?o=list_pro><!-- <th></th>--></table这么写单击可以获取到pid,也可以让#dg_project这个datagrid进行加载,但是不显示数据,可以帮忙修改下吗? 要的效果跟他有些差距。 我是在dg1上获取id 传到php,然后php通过这个id查询数据后把数据再返回到dg2上。现在遇到了一些问题。 dg2的url是这么写的 url="../php/trade.php"dg1的onclickrow传的url="../php/trade.php?pid="+row.pid我觉得可能是dg2的url的问题。但是dg2的url后面又不能加上+row.pid <table id="dg" title="投资记录" class="easyui-datagrid" style="height: 500px; width: 100%;" url="../php/trade.php?o=list" pagesize="50" toolbar="#toolbar" pagination="true" fitColumns="true" rownumbers="true" singleSelect="true"> <thead> <tr> <th field="pid" align="center" width="70">产品单号</th> <th field="project_amount" align="center" width="50">金额</th> <th field="value_date" align="center" width="50">起息日</th> <th field="due_date" align="center" width="50">到期日</th> <th field="term" align="center" width="40" formatter="formatTerm">期限</th> <th field="term_type" align="center" width="40" formatter="formatTtype">期限类型</th> <th field="invest_rate" align="center" width="50">投资利率</th> <th field="invest_once" align="center" width="50">单笔投资</th> <th field="use_reward" align="center" width="50" formatter="formatRtype">可用红包类型</th> <th field="invest_allow_back" align="center" width="50" formatter="formatSH">赎回</th> <th field="publish_invest" align="center" width="50" formatter="formatAllowBack">发布理财</th> <th field="description" align="center" width="50">简单描述</th> <th field="invest_amount" align="center" width="50">已投金额</th> <th field="invest_count" align="center" width="50">已投次数</th> </tr> </thead> </table> <div data-options="region:'center'" style="width: 50%;"> <table id="dg_project" title="项目投资者" class="easyui-datagrid" data-options="fit:true" toolbar="searchtool" style="height: 348px;" pagination="true" fitColumns="true" rownumbers="true" singleSelect="true"> <thead> <tr> <th field="phone" width="50">手机号</th> <th field="name" width="50">姓名</th> <th field="trade_amount" width="50">投资金额</th> </tr> </thead> </table> </div> var url; $(document).ready(function() { $('#dg').datagrid({ onClickRow:function () { var row = $('#dg').datagrid("getSelected"); url = '../php/trade.php?o=list_pro&pid='+row.pid; } }); }); <?phpif($o == 'list_pro'){ $pid = $_GET['pid']; $page = isset($_POST['page']) ? intval($_POST['page']) : 1; $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10; $page = isset($_GET['page']) ? intval($_GET['page']) : $page; $rows = isset($_GET['rows']) ? intval($_GET['rows']) : $rows; $index = ($page - 1) * $rows; $total = "select count(tid) from e_trade"; $sql = "SELECT a.trade_amount, c.phone, c.name from e_trade a join e_project b on a.pid = b.pid join e_user c on c.uid = a.uid where b.pid = '$pid' limit $index, $rows"; echo get_js_page($total, $sql);}?> php函数优先级问题 问个入门级的问题 如何知道用户是从什么 地方来到本页? 正则的一个问题 PHP 如何判断映射目录是否存在? 面试的时候问的题目,和大家一起探讨一下? 关于无限分类的问题 请问如何用PHP实现修改IE的主页? 急:关于生成静态页面新闻程序问题。。 巨好的在线统计!!!!!! 为什么空减空输出是0? php中怎么去除二维数组的某个字段?
这个示例不能满足你的要求吗?
$(document).ready(function() {
$('#dg').datagrid({
onClickRow:function () {
var row = $('#dg').datagrid("getSelected");
url = '../php/trade.php?o=list_pro&pid='+row.pid;
$('#dg_project').datagrid('reload');
// alert('pid='+row.pid);
}
});
});
<table id="dg_project" class="easyui-datagrid" url="../php/trade.php?o=list_pro>
<!--
<th></th>
-->
</table
这么写单击可以获取到pid,也可以让#dg_project这个datagrid进行加载,但是不显示数据,可以帮忙修改下吗?
现在遇到了一些问题。 dg2的url是这么写的 url="../php/trade.php"
dg1的onclickrow传的url="../php/trade.php?pid="+row.pid
我觉得可能是dg2的url的问题。但是dg2的url后面又不能加上+row.pid
<table id="dg" title="投资记录" class="easyui-datagrid" style="height: 500px; width: 100%;"
url="../php/trade.php?o=list" pagesize="50" toolbar="#toolbar" pagination="true" fitColumns="true" rownumbers="true" singleSelect="true">
<thead>
<tr>
<th field="pid" align="center" width="70">产品单号</th>
<th field="project_amount" align="center" width="50">金额</th>
<th field="value_date" align="center" width="50">起息日</th>
<th field="due_date" align="center" width="50">到期日</th>
<th field="term" align="center" width="40" formatter="formatTerm">期限</th>
<th field="term_type" align="center" width="40" formatter="formatTtype">期限类型</th>
<th field="invest_rate" align="center" width="50">投资利率</th>
<th field="invest_once" align="center" width="50">单笔投资</th>
<th field="use_reward" align="center" width="50" formatter="formatRtype">可用红包类型</th>
<th field="invest_allow_back" align="center" width="50" formatter="formatSH">赎回</th>
<th field="publish_invest" align="center" width="50" formatter="formatAllowBack">发布理财</th>
<th field="description" align="center" width="50">简单描述</th>
<th field="invest_amount" align="center" width="50">已投金额</th>
<th field="invest_count" align="center" width="50">已投次数</th>
</tr>
</thead>
</table>
<div data-options="region:'center'" style="width: 50%;">
<table id="dg_project" title="项目投资者" class="easyui-datagrid" data-options="fit:true" toolbar="searchtool" style="height: 348px;" pagination="true" fitColumns="true" rownumbers="true" singleSelect="true">
<thead>
<tr>
<th field="phone" width="50">手机号</th>
<th field="name" width="50">姓名</th>
<th field="trade_amount" width="50">投资金额</th>
</tr>
</thead>
</table>
</div>
var url;
$(document).ready(function() {
$('#dg').datagrid({
onClickRow:function () {
var row = $('#dg').datagrid("getSelected");
url = '../php/trade.php?o=list_pro&pid='+row.pid;
}
});
});
<?php
if($o == 'list_pro')
{
$pid = $_GET['pid'];
$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
$page = isset($_GET['page']) ? intval($_GET['page']) : $page;
$rows = isset($_GET['rows']) ? intval($_GET['rows']) : $rows;
$index = ($page - 1) * $rows;
$total = "select count(tid) from e_trade";
$sql = "SELECT a.trade_amount, c.phone, c.name from e_trade a join e_project b on a.pid = b.pid join e_user c on c.uid = a.uid where b.pid = '$pid' limit $index, $rows";
echo get_js_page($total, $sql);
}
?>