json数据无法在easyui模板中显示数据

浏览:2108 发布日期:2016/01/18 分类:求助交流
控制器显示的json格式数据是:{"total":3,"rows":[{"productID":"CDW-30K-34","productName":"\u56fa\u5b9a\u5f0f\u771f\u7a7a\u7f20\u7ed5\u4f4e\u6e29\u50a8\u7f50"},{"productID":"CFL-150K-12","productName":"\u56fa\u5b9a\u5f0f\u771f\u7a7a\u7edd\u70ed\u4f4e\u6e29\u50a8\u7f50"},{"productID":"CFL-150K-13","productName":"\u56fa\u5b9a\u5f0f\u771f\u7a7a\u7edd\u70ed\u4f4e\u6e29\u50a8\u7f50"}]}
控制器代码:public function index(){
        $product=M('product')->select();
        $qty=count(M('product')->select());
        $result["total"]=$qty;
        $result["rows"]=$product;
        echo json_encode($result);
        //$json_string=json_encode($product);
        //$obj=json_decode($json_string);
        //$this->ajaxReturn($result);
        //dump($product);die;
        //$json='{"total":'.$total.',"rows":'.json_encode($userlist).'}';
        $this->display();
模板代码:<table id="dg" title="My Users" class="easyui-datagrid" style="width:700px;height:250px"
            url="{:U('Index.php/Index/Product/index')}"            
            rownumbers="true" fitColumns="true" singleSelect="true">
        <thead>
            <tr>
                <th field="productID" width="50">subjectcode</th>
                <th field="productName" width="250">Question</th>
            </tr>
        </thead>
    </table>
结果easyUI的标题可以显示,但数据就是出不来,不知道是什么原因?
最佳答案
评论( 相关
后面还有条评论,点击查看>>