jQuery plugin jqgrid에서 데이터 안나오는 현상
스크립트 처리부분 :
jQuery("#list2").jqGrid({
url:'http://localhost:8080/Test/RequestSErvlet?urlAddress=http://oxdemo-ui.openxenterprise.com/codeigniter/a/site/?overload=medium',
datatype: "json",
colNames:['ID','NAME','STATUS'],
colModel:[
{name:'id',index:'id', width:55},
{name:'name',index:'name', width:55},
{name:'status',index:'status', width:55}
/*
{name:'invdate',index:'invdate', width:90},
{name:'name',index:'name asc, invdate', width:100},
{name:'amount',index:'amount', width:80, align:"right"},
{name:'tax',index:'tax', width:80, align:"right"},
{name:'total',index:'total', width:80,align:"right"},
{name:'note',index:'note', width:150, sortable:false} */
],
rowNum:10,
rowList:[10,20,30],
pager: '#pager2',
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:"JSON Example"
});
jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
return 데이터
[{"id":"3933","name":"Mafia Wars","status":"Active","url":"http://www.mafiawars.com","content_topic_id":"2702","content_type_id":"17","external_id":null,"notes":null,"delivery_medium_id":"2","account_id":"5532","modified_date":"2011-06-13 05:19:19","created_date":"2011-06-01 18:29:13","deleted":"0","domain_override":null,"category_override":null},{"id":"3934","name":"Angry Birds","status":"Active","url":"http://www.rovio.com","content_topic_id":"2701","content_type_id":"15","external_id":null,"notes":null,"delivery_medium_id":null,"account_id":"5531","modified_date":"2011-06-21 01:37:20","created_date":"2011-06-01 .......
Servlet
private void process(HttpServletRequest request, HttpServletResponse response) {
String url = request.getParameter("urlAddress");
RequestProcessor requestProcessor = new RequestProcessor();
response.setContentType("text/plain;charset=UTF-8");
try {
JSONArray array = requestProcessor.printWebPage(url);
request.setAttribute("pager2", "1");
request.setAttribute("rows", "1");
request.setAttribute("json", array);
//RequestDispatcher dispatcher = request.getRequestDispatcher("index.html");
//dispatcher.forward(request, response);
response.setContentType("appliciation/json");
response.setCharacterEncoding("utf-8");
System.out.println(array.toString());
response.getWriter().write(array.toString());
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
'Javascript' 카테고리의 다른 글
jQuery Grid (0) | 2011.07.08 |
---|---|
Javascript Eclipse Plugin (0) | 2011.07.08 |