日期:2014-05-16  浏览次数:20366 次

js获取easyui datagrid中的数据,并拼接成json
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&nbs