js获取easyui datagrid中的数据,并拼接成json

飞舞的锄头 2014-03-12 03:40:45
php页面A中有datagrid
<table id="adg"  class="easyui-datagrid" style="width:410px;height:auto" title="Region(day)"
data-options="
showFooter: true,
url: 'daily_all_area.php',
singleSelect: true,
rowStyler: function(index,row){
if (row.area_no=='TOTAL'){
return 'background-color:#6293BB;color:#fff;font-weight:bold;';
}
}
"
>
<thead>
<tr>
<th field="area_no" width="100" formatter="getArea"><strong>Region Name</strong></th>
<th field="daily_quantity_area" width="80" align='right'><strong>Quantity</strong></th>
<th field="daily_sales_area" width="120" formatter="getSales" align='right'><strong>Sales(VAT)</strong></th>

<th field="percent_d" width="100" align='right'><strong>% of total<br>amount</strong></th>
</tr>
</thead>
</table>

其中的url指向一个生成json的php文件,json格式如下:
{"rows":[{"0":"W",''XXX","1":"56","YY":56,......}]}

现在想在php页面A中把上面json中的在js中提取出来形成新的json格式如下
[XXX,56]
其中XXX是W对应的值,56是YY对应的值。这样的js该怎么写?我写了一半但不能取得值

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>

<link href="css/core.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="http://www.java1234.com/jquery-easyui-1.3.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.java1234.com/jquery-easyui-1.3.3/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.java1234.com/jquery-easyui-1.3.3/demo/demo.css">
<script type="text/javascript" src="http://www.java1234.com/jquery-easyui-1.3.3/jquery.min.js"></script>
<script type="text/javascript" src="http://www.java1234.com/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="http://www.java1234.com/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script src="js/jquery.1.3.2.js" type="text/javascript" language="javascript"></script>
<script src="js/popup_layer.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript">
var pie_data=new Array();
function getArea(value,row,index){
pie_data[row]=value;
return value;
onmouseout='small(this)'/>";

}
function getSales(value,row,index){
pie_data[row]=value;
return value;
onmouseout='small(this)'/>";

}
var json = JSON.stringify(pie_data);
</script>
</head>
<body>

<table id="adg" class="easyui-datagrid" style="width:410px;height:auto" title="Region(day)"
data-options="
showFooter: true,
url: 'daily_all_area.php',
singleSelect: true,
rowStyler: function(index,row){
if (row.area_no=='TOTAL'){
return 'background-color:#6293BB;color:#fff;font-weight:bold;';
}
}

"
>
<thead>
<tr>
<th field="area_no" width="100" formatter="getArea"><strong>Region Name</strong></th>
<th field="daily_quantity_area" width="80" align='right'><strong>Quantity</strong></th>
<th field="daily_sales_area" width="120" formatter="getSales" align='right'><strong>Sales(VAT)</strong></th>

<th field="percent_d" width="100" align='right'><strong>% of total<br>amount</strong></th>
</tr>
</thead>
</table>
</body>
</html>

...全文
1231 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
飞舞的锄头 2014-04-05
  • 打赏
  • 举报
回复
引用 2 楼 xuzuning 的回复:
已经解决了?
解决了 翻书看了下json相关的
xuzuning 2014-04-05
  • 打赏
  • 举报
回复
已经解决了?
飞舞的锄头 2014-04-02
  • 打赏
  • 举报
回复
散分咯 来接分啊

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧