开发者

jqgrid java list from controller

I have a jqgrid where in I am returning a list of objects from the controller... I have used the List collection interface of java.util package.... and returning that...

@RequestMapping("tas开发者_运维问答k-management.html")
public @ResponseBody List<TaskBean> getStatus()
{
    System.out.println("\nin task mgmt controller");
    taskList.add(new TaskBean("Task1", "K-CY-329", "144", "G-3", "1", "Pending", "XYZ"));
    taskList.add(new TaskBean("Task2", "K-CY-356", "165", "A-10", "4", "Closed", "ABC"));
    taskList.add(new TaskBean("Task3", "K-CY-343", "768", "B-12", "3", "Pending", "IJK"));
    taskList.add(new TaskBean("Task4", "K-CY-786", "918", "F-9", "2", "Open", "PQR"));
    return taskList; 
}

and i have given the corresponding in jqgrid's url with datatype set to json.... I am using spring mvc3.0 controller.... this controller function gets called successfully.... But i cant see the TaskBean objects getting rendered to the jqgrid.... Please help!!!


$("#task-list-table").jqGrid({
    autowidth: true,
    datatype : "json",
    url: "task-management.html",
    mtype: 'POST',
    colNames : ["Title","Order ID","Realty","Building",
                "Priority","Action","Assignee"],
    colModel : [
        {label: "Title",   name: "title",   index: "Title"},
        {label: "OrderID", name: "orderId", index: "OrderID", jsonmap: "orderId"},
        {label: "Realty",  name: "realty",  index: "Realty",  jsonmap: "realty" },
        {label: "Building",name: "building",index: "Building",jsonmap: "building"},
        {label: "Priority",name: "priority",index: "Priority",jsonmap: "priority"},
        {label: "Action",  name: "action",  index: "Action",  jsonmap: "action"  },
        {label: "Assignee",name: "assignee",index: "Assignee",jsonmap: "assignee"}
    ],
    sortname : "Title",
    sortorder : "desc",
    shrinkToFit: true,
    viewrecords: true,
    jsonReader : {
        repeatitems : false
    },
    onSelectRow: function(){
        alert(jQuery("#task-list-table").getGridParam('selrow'));
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜