2014-02-13 50 views
0

我在Concrete5 CMS工作的工作,我不知道什麼是錯在此代碼,刪除功能在jqGrid的使用具體的CMS

查看網頁腳本

var myData = <?php echo json_encode($sl) ?>; 

    $("#statGrid").jqGrid({ 
     caption: 'Status List', 
     datatype:'local', 
     data: myData, 
     mtype:'POST', 
     colNames:['sID','Status Name','Type','Description'], 
     colModel:[ 
      {name:'status_id',editable:true }, 
      {name:'status_name',editable:true }, 
      {name:'status_type',editable:true }, 
      {name:'status_description', editable:true, edittype: 'textarea' } ], 
     width: "777", 
     height: "auto", 
     pager:'#statPager', 
     rowNum:5, 
     rowList:[5,10,20,30], 
     rownumbers: true, 
     viewrecords: true, 
     recreateForm:true, 
     gridView: true, 
     autoencode: true, 
     loadui:'enable' 

    }).navGrid("#statPager",{add:false, edit:false, view:false, del:true, search:false, refresh:false }, 
    { 
    reloadAfterSubmit: true, 
    jqModal: true, 
    closeOnEscape: true, 
    closeAfterEdit: true, 
    url: "deleteStatus", 
    afterSubmit: function (response, postdata) { 
     if (response.responseText == "Success") { 
      jQuery("#success").show(); 
      return [true, response.responseText]; 
     } else { 
        return [false, response.responseText]; 
      } 
     } 
    }); 

請ANY1幫助如何在「deleteStatus」函數的url中調用我的控制器函數。

還有一件事是「closeOnEscape:真不工作」

回答

0

正如我所看到的,你的推杆刪除PARAMS到錯誤的位置。 (「#grid_id」),{參數},prmEdit,prmAdd,prmDel,prmSearch,prmView);

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:navigator

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing

所以,你的情況嘗試:

.navGrid("#statPager",{add:false, edit:false, del:true, search:false, refresh:false }, 
     {},{}, 
     { 
     reloadAfterSubmit: true, 
     jqModal: true, 
     closeOnEscape: true, 
     url: "deleteStatus", 
     afterSubmit: function (response, postdata) { 
      if (response.responseText == "Success") { 
       jQuery("#success").show(); 
       return [true, response.responseText]; 
      } else { 
         return [false, response.responseText]; 
       } 
      } 
     } 
,{},{});