Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery如何处理映射?_Javascript_Jquery_Spring_Maven - Fatal编程技术网

Javascript jquery如何处理映射?

Javascript jquery如何处理映射?,javascript,jquery,spring,maven,Javascript,Jquery,Spring,Maven,我正在和maven一起做一个spring mvc项目。我想显示一个包含项目的jqxGrid。我通过映射获取项目。问题是,我获取了网格,但没有显示项目。通过映射从控制器返回数据。jquery如何处理返回的映射 我的jquery代码 $(document).ready(function () { var source = { datatype: "json",

我正在和maven一起做一个spring mvc项目。我想显示一个包含项目的jqxGrid。我通过映射获取项目。问题是,我获取了网格,但没有显示项目。通过映射从控制器返回数据。jquery如何处理返回的映射

我的jquery代码

       $(document).ready(function () {
             var source =
                {     
                    datatype: "json",
                    type:"GET",
                    url: "account/list",
                    datafields: [
                        { name: 'id' },
                        { name: 'periodname' },
                        { name: 'startdate' },
                        { name: 'enddate' },
                        { name: 'isactive' }
                    ],
                    sort: function () {
                        $("#jqxgrid").jqxGrid('updatebounddata', 'sort');
                        },

                    id: 'id'
                };


             var dataAdapter = new $.jqx.dataAdapter(source, {loadError: function (xhr, status, error) {

                        }
             });

$("#jqxgrid").jqxGrid(
        {

            width: 800,
            source: dataAdapter,
            pageable: true,

            autoheight: true,

            columns: [
              { text: 'Period Name', datafield: 'periodname', width: 200 },
              { text: 'Start Date', datafield: 'startdate', width: 200 },
              { text: 'End Date', datafield: 'enddate', width: 200 },
              { text: 'Active', datafield: 'isactive', width: 200 }
            ]
        });

        $("#addrowbutton").jqxButton({ theme: theme });
        $("#deleterowbutton").jqxButton({ theme: theme });
        $("#updaterowbutton").jqxButton({ theme: theme });

        // initialize jqxGrid
               // });
    });
    </script>
$(文档).ready(函数(){
变量源=
{     
数据类型:“json”,
键入:“获取”,
url:“帐户/列表”,
数据字段:[
{name:'id'},
{name:'periodname'},
{name:'startdate'},
{name:'enddate'},
{name:'isactive'}
],
排序:函数(){
$(“#jqxgrid”).jqxgrid('updatebounddata','sort');
},
id:'id'
};
var dataAdapter=new$.jqx.dataAdapter(源代码,{loadError:function(xhr,status,error){
}
});
$(“#jqxgrid”).jqxgrid(
{
宽度:800,
来源:dataAdapter,
pageable:对,
自动高度:正确,
栏目:[
{文本:“时段名称”,数据字段:“时段名称”,宽度:200},
{文本:“开始日期”,数据字段:“开始日期”,宽度:200},
{文本:“结束日期”,数据字段:“结束日期”,宽度:200},
{文本:'Active',数据字段:'isactive',宽度:200}
]
});
$(“#addrowbutton”).jqxButton({theme:theme});
$(“#deleterowbutton”).jqxButton({theme:theme});
$(“#updaterowbutton”).jqxButton({theme:theme});
//初始化jqxGrid
// });
});
控制器

 @Controller
 @RequestMapping(value="/account")
 public class AccountsController {
@Autowired
private AccountService accountService;
@Autowired
private AccountDAO accountDao;

 @RequestMapping(value="/list",method = RequestMethod.GET,produces="application/json")
 @ResponseBody
 public Map<String, Object> getAccounts(Map<String, Object> map) {

    map.put("all_item_issue_headers", accountDao.getAccounts());
    System.out.println(map);
    return map;

}
}
@控制器
@请求映射(value=“/account”)
公共类帐户控制器{
@自动连线
私人帐户服务;
@自动连线
私人帐户;
@RequestMapping(value=“/list”,method=RequestMethod.GET,products=“application/json”)
@应答器
公共地图帐户(地图){
map.put(“所有项目发布标题”,accountDao.getAccounts());
系统输出打印项次(map);
返回图;
}
}

等待您的回复。谢谢。回复将是json。键是
所有项目\问题\标题

  var response = yourJson; // this is the map

  var array = yourJson[all_item_issue_headers]; // this is an array

响应将是一个json。键是
所有项目\问题\标题

  var response = yourJson; // this is the map

  var array = yourJson[all_item_issue_headers]; // this is an array

响应将是一个json。键是
所有项目\问题\标题

  var response = yourJson; // this is the map

  var array = yourJson[all_item_issue_headers]; // this is an array

响应将是一个json。键是
所有项目\问题\标题

  var response = yourJson; // this is the map

  var array = yourJson[all_item_issue_headers]; // this is an array


你的控制器上有正确的注释吗?现在我包括我的控制器。还有一件事它的输出是什么
returnmap它是一个对象
{}
或对象数组
[{},{},……n]
它是这样的{all_item_issue_headers}=[com.gerrytan.pizzashop。Accounts@1d7efa3,com.gerrytan.pizzashop。Accounts@1b5d60d,com.gerrytan.pizzashop。Accounts@f805e6,com.gerrytan.pizzashop。Accounts@14b5721,com.gerrytan.pizzashop。Accounts@145468d,com.gerrytan.pizzashop。Accounts@11af268,com.gerrytan.pizzashop。Accounts@209197]}我假设你想返回JSON。你的类路径中有jackson库吗?你的控制器上有正确的注释吗?现在我包括我的控制器。还有一件事它的输出是什么
返回映射;
它是一个对象
{}
或对象数组
[{},{},……n]
它是这样的{all\u item\u issue\u headers=[com.gerrytan.pizzashop。Accounts@1d7efa3,com.gerrytan.pizzashop。Accounts@1b5d60d,com.gerrytan.pizzashop。Accounts@f805e6,com.gerrytan.pizzashop。Accounts@14b5721,com.gerrytan.pizzashop。Accounts@145468d,com.gerrytan.pizzashop。Accounts@11af268,com.gerrytan.pizzashop。Accounts@209197]}我假设你想返回JSON。你的类路径中有jackson库吗?你的控制器上有正确的注释吗?现在我包括我的控制器。还有一件事它的输出是什么
返回映射;
它是一个对象
{}
或对象数组
[{},{},……n]
它是这样的{all\u item\u issue\u headers=[com.gerrytan.pizzashop。Accounts@1d7efa3,com.gerrytan.pizzashop。Accounts@1b5d60d,com.gerrytan.pizzashop。Accounts@f805e6,com.gerrytan.pizzashop。Accounts@14b5721,com.gerrytan.pizzashop。Accounts@145468d,com.gerrytan.pizzashop。Accounts@11af268,com.gerrytan.pizzashop。Accounts@209197]}我假设你想返回JSON。你的类路径中有jackson库吗?你的控制器上有正确的注释吗?现在我包括我的控制器。还有一件事它的输出是什么
返回映射;
它是一个对象
{}
或对象数组
[{},{},……n]
它是这样的{all\u item\u issue\u headers=[com.gerrytan.pizzashop。Accounts@1d7efa3,com.gerrytan.pizzashop。Accounts@1b5d60d,com.gerrytan.pizzashop。Accounts@f805e6,com.gerrytan.pizzashop。Accounts@14b5721,com.gerrytan.pizzashop。Accounts@145468d,com.gerrytan.pizzashop。Accounts@11af268,com.gerrytan.pizzashop。Accounts@209197]}我假设您想要返回JSON。您的类路径中有jackson libs吗?