2015-11-04 18 views
1

我正在使用jqgrid從MS Sql Server使用asp classic加載數據。 我正確地形象化了我的所有記錄,並使用#pager可以addedit他們。 我不能使用delete,因爲當我點擊那個按鈕並且彈出窗口打開時,我無法傳遞參數(id_city):這是我的大問題。它不顯示任何錯誤消息。jqGrid與<delete>按鈕:我無法傳遞參數

我嘗試發佈一些代碼(我不知道如何格式化):

$(document).ready(function(){ 
    $("#list").jqGrid({ 
     url:'loadxml.asp', //this execute a stored procedure and create a xml document 
     datatype: 'xml', 
     mtype: 'GET', 
     colNames:["id_city","name_city"], 
     colModel :[ 
      {name:'id_city', index:'id_city',editable:true, width:100,reloadAfterSubmit: true}, 
      {name:'name_city', editable:true,reloadAfterSubmit: true,index:'name_city',width:300, reloadAfterSubmit: true,closeAfterAdd:true,reloadAfterSubmit:true} 
     ], 
     height:600, 
     rowNum:50, 
     pager : '#pager', 
     viewrecords: false, 
     imgpath: 'css/ui-lightness/images', 
     loadonce: false, 
     xmlReader: { 
      root : "NewDataSet", 
      row: "Table", 
      repeatitems: false, 
      id: "id_city" 
     }, 
     sortorder: "name_city", 
     caption:'summary', 
     editurl:"edit.asp" // here there is a select case... I can't pass id_city to delete 
    }); 
    jQuery("#list").jqGrid('navGrid','#pager',{edit:true,add:true,del:true,search:false,refresh:false}); 
    $('#pager_center').empty(); // workaround to see only <edit>,<add>,<delete> buttons   
}); 
+0

在您的html表單中是否存在一個名爲'id_city'的字段?嘗試在構建它之後寫出SQL字符串:是否獲得有效的SQL語句?你有SQL服務器上的刪除權限嗎? – Martha

回答

0

添加以下行之前colModel

prmNames: {id: "id_city"},