2010-07-30 4 views
2

jqgrid에서 레코드를 삭제하고 싶습니다. 이것에 대한 나는 이미지가 있고 사용자가 이것을 클릭하면 레코드가 삭제됩니다.하지만 확인 상자를 표시하려면 true로 설정하면 레코드 만 삭제되어야합니다. 그래서 아무도 jqgrid에서 javascript를 호출하는 방법을 알 수 있습니다. 내있는 jqGrid는 jQuery를 (문서) .ready (함수() { jQuery를 ("#의 list47")있는 jqGrid ({ URL이다. '? AddFilterGrid.aspx 표시 = ViewFilter', 데이터 형식 : "JSON", ID : colMames : [ "SubCategory", "Filter", 'Delete', 'Edit'], colModel : [ {name : 'CategoryName', 인덱스 : 'CategoryName', 너비 : 150, 정렬 : 'name' 'FilterName', index : 'FilterName', 너비 : 150, 정렬 : '왼쪽', 정렬 가능 : 참, sorttype : 'text'}, 정렬 : true, sorttype : '텍스트'} asp.net에서 jqgrid의 레코드 삭제

 { name: 'f', index: 'f', width: 100, align: "center", formatter: 'showlink', formatter: formateadorLinkDelete }, 


    { name: 'FilterId', index: 'FilterId', width: 100, align: "center", formatter: 'showlink', formatter: formateadorLinkEdit }, 

     ], 
      height: 280, 
      width: 650, 
      //autowidth: true, 
      mtype: "GET", 
      pager: '#plist47', 
      rowNum: 10, 
      rowList: [10,20,30,40], 
      repeatitems: false, 
      viewrecords: true, 
      sortname: 'FilterName', 
      viewrecords: true, 
      sortorder: "desc", 
      gridview: true, 
      imgpath: '/Scripts/themes/redmond/images' 
     }); 

    }); 

답변

1

열에 삭제 버튼이 있으면 버튼에 속성이있는 ID를 지정하면 해당 ID를 게시하여 삭제할 수 있습니다.

당신의 삭제 컨트롤러 편집 @

$.post('url/delete/$(this).val("deletid")', function(data) { 
    $('.result').html(data); 
}); 

에 게시물을 수행하여 colums 중 하나에서 삭제 링크를 생성, 클래스 = "삭제"및 deleteid = "아이디" 당신은 확인을 만들 수 있습니다 팝업 상자 :

$(function(){ 
    $(.delete).foreach(function(){ 
     $('#dialog').dialog({ 
      autoOpen: false, 
      width: 400, 
      modal: true, 
      resizable: false, 
      buttons: { 
       "Submit": function(){ 
          $.post('url/delete/$(this).val("deletid")', function(data) { 

           //find your tr and hide it 
           $(this).parent().parent.... .hide(); 
          }); 
          }; 
       }, 
       "Cancel": function() { 
        $(this).dialog("close"); 
       } 
      } 
     }); 
});