2011-04-29 5 views
0

있는 jqGrid는 니펫을 :jqgrid : id 속성 값 대신 "eData"를 왜 드러내는가?

gridComplete: function(){ 

    var ids = jQuery("#breed_list").jqGrid('getDataIDs'); 
    for(var i=0;i < ids.length;i++) 
    { 
     var cl = ids[i]; 
     ed = "<img src="../images/edit.png" alt="Edit" onclick="jQuery('#breed_list').editRow('"+cl+"');" />"; 
     de = "<img class="del_row" src="../images/delete.png" alt="Delete" />"; 
     ce = "<input class="del_row" type='button' onclick="deleteRow()" />"; 
     jQuery("#breed_list").jqGrid('setRowData',ids[i],{act:ed+de+ce}); 
    } 

    $(this).mouseover(function() { 
     var valId = $('.ui-state-hover').attr("id"); 
     jQuery("#breed_list").setSelection(valId, false); 
     alert(valId); 
     //deleteRow(valId) 
    }); 

사용자 정의 기능 코드 : delGridRow이 실행되지 않을 때

function deleteRow(){ 

    // Get the currently selected row 
    var toDelete = $("#breed_list").jqGrid('getGridParam','selrow'); 

    // You'll get a pop-up confirmation dialog, and if you say yes, 
    // it will call "delete.php" on your server. 
    $("#breed_list").jqGrid(
     'delGridRow', 
     toDelete, 
      { 
       url: 'delete.php', 
       reloadAfterSubmit:false 
      } 
    ); 
    //alert(toDelete); 

} 

그 코드를 자동으로 올바르게 공중 선회 셀을 선택합니다. 작업 열 아래에있는 버튼을 클릭하면 delGridRow를 실행하는 deleteRow() 함수가 호출됩니다. 취소를 클릭하면 양식 삭제가 닫힙니다. 이제, 셀을 가리키면 현재 갇힌 셀을 자동으로 선택하지 않습니다. 이 디버깅하려면 id 속성 값 대신 eData를 반환하는 .mouseover 함수에 경고 (valId)를 배치했습니다. alert (valId)는 deleteRow 함수가 실행되지 않는 한 id 속성 값을 경고합니다. id 속성 값을 반환해야 할 때 eData를 valId로 설정하는 이유는 무엇입니까? 이 문제를 어떻게 해결합니까?

편집은 분명히 나는 ​​이것에 대해 어려운 길을 가고있다. 나는 기본 그리드와 gridComplete로 돌아갔다. 이제 마법처럼

function deleteRow(valId){ 

    jQuery("#breed_list").setSelection(valId, false); 

    // You'll get a pop-up confirmation dialog, and if you say yes, 
    // it will call "delete.php" on your server. 
    $("#breed_list").jqGrid(
     'delGridRow', 
     valId, 
      { 
       url: 'delete.php', 
       reloadAfterSubmit:false 
      } 
    ); 
    //alert(toDelete); 

} 

작동하지만, 앞서 설명한대로 난 여전히 mousehover 기능을 통합하고 싶습니다 :

de = "<input style='height:22px;width:20px;' type='button' value='d' onclick=\"deleteRow('"+cl+"');\" />"; 

deleteRow를 기능 코드 :

있는 jqGrid는 니펫을.

+0

무엇을 의미합니까? – dottedquad

+1

모든 질문에 대해 사람들이 제출 한 답변으로 이동하고 체크 표시를 클릭하여 대답을 수락하십시오. – slandau

+0

다른 사람들의 신뢰도를 높이는 의미를 지녔지 만이를 성취하는 방법을 알지 못했습니다. 이제 나는 :-) – dottedquad

답변

0

분명히 나는이 어려운 방법으로 가고 있습니다. 나는 기본 그리드와 gridComplete로 돌아갔다. 이제 마법처럼

de = "<input style='height:22px;width:20px;' type='button' value='d' onclick=\"deleteRow('"+cl+"');\" />"; 

deleteRow function code: 

    function deleteRow(valId){ 

     jQuery("#breed_list").setSelection(valId, false); 

     // You'll get a pop-up confirmation dialog, and if you say yes, 
     // it will call "delete.php" on your server. 
     $("#breed_list").jqGrid(
      'delGridRow', 
      valId, 
       { 
        url: 'delete.php', 
        reloadAfterSubmit:false 
       } 
     ); 
     //alert(toDelete); 

    } 

작품을하지만, 앞서 설명한대로 난 여전히 mousehover 기능을 통합하고 싶습니다 :

있는 jqGrid는 니펫을.