editUrl在jqGrid中不起作用

时间:2016-04-27 12:59:56

标签: javascript jquery jqgrid

伙计我正在使用jqgrid,我完全是新手,所以PLZ帮助我..每当我添加新记录时,它都会给我error Status: 'Not Found'. Error code: 404

这是我的代码

 
        $(document).ready(function () {
            $("#jqGrid").jqGrid({
                url: 'data.json',
                datatype: "json",
                styleUI : "Bootstrap",
                colModel: [
                           { label: 'Order ID', name: 'OrderID', key: true, width: 75, hidden:true },                   
                           { label: 'From Date', name: 'FromDate', width: 150,
                        	   editable: true,
                               edittype:"text",
                               id : "ui-datepicker-div",
                               editoptions: {
                                   dataInit: function (element) {
                                      $(element).datepicker({
                                    		autoclose: true,
        									format: 'yyyy-mm-dd',
        									orientation : 'auto bottom'
                                      });
                                   },
                                   
                               },
                           },
                           { label: 'To Date', name: 'ToDate', width: 150,
                        	   editable: true,
                               edittype:"text",
                               editoptions: {
                                   dataInit: function (element) {
                                      $(element).datepicker({
                                    		autoclose: true,
        									format: 'yyyy-mm-dd',
        									orientation : 'auto bottom'
                                      });
                                   },
                                   
                               },
                           },
                            { label: 'Customer ID', name: 'CustomerID', width: 150},
                           { label: 'Ship Name', name: 'ShipName', width: 200},
                           {
                        	   label :'Row Data',
                               name: 'RowData',
                               align : 'center',
                               formatter: function () {
                                   return "<img src='resources/icon.jpg' onclick='OpenDialog(this)' alt='Data Row' />";
                                   width = 15;
                               }
                           },
                       ],
				.......
				editurl : "BootstrapJqGrid/servlet/JqGridServlet",
                .......
                pager: "#jqGridPager",
                	.....
            });
            $('#jqGrid').navGrid("#jqGridPager", {
            	edit: true, 
            	add: true, 
            	del: true, 
            	refresh: true, 
            	view: false
            	});                
        });

       .......

data.json

{ 
"rows":[
    {"OrderID":"10248","FromDate":"1996-07-04","CustomerID":"WILMK","ShipName":"Vins et alcools Chevalier","ToDate":"1996-07-05"},
    {"OrderID":"10249","FromDate":"1996-07-05","CustomerID":"TRADH","ShipName":"Toms Spezialit\u00e4ten","ToDate":"1996-07-17"},
    {"OrderID":"10250","FromDate":"1996-07-08","CustomerID":"HANAR","ShipName":"Hanari Carnes","ToDate":"1996-07-26"},
    {"OrderID":"10251","FromDate":"1996-07-08","CustomerID":"VICTE","ShipName":"Victuailles en stock","ToDate":"1996-08-01"},
    {"OrderID":"10252","FromDate":"1996-07-09","CustomerID":"SUPRD","ShipName":"Supr\u00eames d\u00e9lices","ToDate":"1996-08-01"},
    {"OrderID":"10253","FromDate":"1996-07-10","CustomerID":"HANAR","ShipName":"Hanari Carnes","ToDate":"1996-08-09"},
    {"OrderID":"10254","FromDate":"1996-07-11","CustomerID":"CHOPS","ShipName":"Chop-suey Chinese","ToDate":"1996-07-31"},
    {"OrderID":"10255","FromDate":"1996-07-12","CustomerID":"RICSU","ShipName":"Richter Supermarkt","ToDate":"1996-08-09"},
    {"OrderID":"10256","FromDate":"1996-07-15","CustomerID":"WELLI","ShipName":"Wellington Importadora","ToDate":"1996-07-16"},
    {"OrderID":"10257","FromDate":"1996-07-16","CustomerID":"HILAA","ShipName":"HILARI\u00d3N-Abastos","ToDate":"1996-07-31"},
    {"OrderID":"10258","FromDate":"1996-07-17","CustomerID":"ERNSH","ShipName":"Ernst Handel","ToDate":"1996-08-01"},
    {"OrderID":"10259","FromDate":"1996-07-18","CustomerID":"CENTC","ShipName":"Centro comercial Moctezuma","ToDate":"1996-08-07"},
    {"OrderID":"10260","FromDate":"1996-07-19","CustomerID":"OLDWO","ShipName":"Ottilies K\u00e4seladen","ToDate":"1996-07-26"},
    {"OrderID":"10261","FromDate":"1996-07-19","CustomerID":"QUEDE","ShipName":"Que Del\u00edcia","ToDate":"1996-08-09"},
    {"OrderID":"10262","FromDate":"1996-07-22","CustomerID":"RATTC","ShipName":"Rattlesnake Canyon Grocery","ToDate":"1996-07-30"},
    {"OrderID":"10263","FromDate":"1996-07-23","CustomerID":"ERNSH","ShipName":"Ernst Handel","ToDate":"1996-08-09"},
    {"OrderID":"10264","FromDate":"1996-07-24","CustomerID":"FOLKO","ShipName":"Folk och f\u00e4 HB","ToDate":"1996-07-30"},
    {"OrderID":"10265","FromDate":"1996-07-25","CustomerID":"BLONP","ShipName":"Blondel p\u00e8re et fils","ToDate":"1996-08-09"},
    {"OrderID":"10266","FromDate":"1996-07-26","CustomerID":"WARTH","ShipName":"Wartian Herkku","ToDate":"1996-07-29"},
    {"OrderID":"10267","FromDate":"1996-07-29","CustomerID":"FRANK","ShipName":"Frankenversand","ToDate":"1996-08-02"},
    {"OrderID":"10268","FromDate":"1996-07-30","CustomerID":"GROSR","ShipName":"GROSELLA-Restaurante","ToDate":"1996-07-30"},
    {"OrderID":"10269","FromDate":"1996-07-31","CustomerID":"WHITC","ShipName":"White Clover Markets","ToDate":"1996-08-02"},
    {"OrderID":"10270","FromDate":"1996-08-01","CustomerID":"WARTH","ShipName":"Wartian Herkku","ToDate":"1996-08-07"},
    {"OrderID":"10271","FromDate":"1996-08-01","CustomerID":"SPLIR","ShipName":"Split Rail Beer & Ale","ToDate":"1996-08-06"},
    {"OrderID":"10272","FromDate":"1996-08-02","CustomerID":"RATTC","ShipName":"Rattlesnake Canyon Grocery","ToDate":"1996-08-07"},
    {"OrderID":"10273","FromDate":"1996-08-05","CustomerID":"QUICK","ShipName":"QUICK-Stop","ToDate":"1996-08-08"},
    {"OrderID":"10274","FromDate":"1996-08-06","CustomerID":"VINET","ShipName":"Vins et alcools Chevalier","ToDate":"1996-08-06"},
    {"OrderID":"10275","FromDate":"1996-08-07","CustomerID":"MAGAA","ShipName":"Magazzini Alimentari Riuniti","ToDate":"1996-08-08"},
    {"OrderID":"10276","FromDate":"1996-08-08","CustomerID":"TORTU","ShipName":"Tortuga Restaurante","ToDate":"1996-08-10"},
    {"OrderID":"10277","FromDate":"1996-08-09","CustomerID":"MORGK","ShipName":"Morgenstern Gesundkost","ToDate":"1996-08-12"}
]
}

servlet

public class JqGridServlet extends HttpServlet{
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    String FromDate = request.getParameter("FromDate");
    System.out.println(FromDate);
    }
}

任何帮助如何克服未找到的editurl 404 ..非常感谢...

0 个答案:

没有答案