2013-05-30 68 views
1

我有一個應用程序使用infragistics asp.net網格。在主頁面中,網格顯示沒有問題。用戶可以從主網格中選擇一行,從那裏彈出第二個網格的對話框。第二個網格只顯示用戶選擇的網格行的細節。 現在我在第二個網格中出現問題,用戶無法修改任何現有值。我沒有發現我在第一個網格的第二個網格中做了什麼不同的事情。請參閱我的代碼:infragistics在對話框中的igGrid不接受用戶的輸入

<script type="text/javascript"> 
$(document).ready(function() { 
     $.ig.loader({ 
      scriptPath: "js/", 
      cssPath: "css/", 
      resources: "igGrid.*" 
     }); 

     $.ajax({ 
      type: "POST", 
      url: "Default.aspx/LoadA", 
      contentType: "application/json; charset=utf-8", 
      dataType: "json", 
      success: OnSuccess, 
      error: function (result) { 
       alert(result.d);    } 
     }); 

     function OnSuccess(result) { 
     $.ig.loader(
     function() { 
     var jsonLocal = new $.ig.JSONDataSource({ dataSource: result.d, responseDataKey: "d" }); 

        $("#tblMain").igGrid({ 
         dataSource: jsonLocal, 
         autoGenerateColumns: false, 
         renderCheckboxes: true, 
         width: "100%", 
         height: "100%", 
         primaryKey: "ColA", 
         columns: [ 
     { key: "ColA", headerText: "ColA", dataType: "number" }, 
     { key: "ColB", headerText: "ColB",ataType: "string" }], 
         features: [ 
         { name: "Updating", 
          editMode: "row", 
          columnSettings: [ 
           { columnKey: "ColA", readOnly: true }          ] 
         }, 
         { name: "Resizing", 
          deferredResizing: false, 
          allowDoubleClickToResize: true 
         }, 
         { 
          name: "Filtering", 
          allowFiltering: true, 
          caseSensitive: false, 
          type: "local" 
         }, 
         { 
         name: "Selection", 
         mode: "row", 
         cellSelectionChanging: igGridCellSelectionChanged 
        } 
         ] //end feature 
       }) //end igGrid 

      } //end function 
      ) //end loader 


     } //end onSuccess 

     $("#tblMain").on("iggridselectionrowselectionchanged", igGridCellSelectionChanged); 

     function igGridCellSelectionChanged(event, ui) { 
      var ColA = ui.row.element[0].cells[0].innerText; 
      $.ajax({ 
       type: "POST", 
       url: "Default.aspx/LoadB", 
       contentType: "application/json; charset=utf-8", 
       dataType: "json", 
       data: '{ColA:"' + ColA+ '"}', 
       success: OnAttachments, 
       error: function (result) { 
        alert(result.d); 
       } 
      }); 

     }; 

     function OnAttachments(result) { 
      $.ig.loader(function() { 
       $.ig.loader(function() { 
     var jsonLocal = new $.ig.JSONDataSource({ dataSource: result.d, responseDataKey: "d" }); 
        $("#tblAttachment").igGrid({ 
         dataSource: jsonLocal, 
         width: "800", 
         height: "80%", 
         autoGenerateColumns: false, 
         primaryKey: "UId", 
         columns: [ 
         { key: "Col1", headerText: "Col1", dataType: "number", width: "50px" }, 
         { key: "Col2", headerText: "Col2", dataType: "string", width: "100px" } 
        ], 
         fixedHeaders: true, 
         showHeader: true, 
         features: [{ name: "Updating"}] 
        }); 
       }); 
      }); 
     }; 


     $('#dialog').dialog({ 
      modal: true, 
      autoOpen: false, 
      closeOnEscape: false, 
      width: 800, 
      height: 500, 
      buttons: [{ text: "OK", 
       click: function() { 
        $("#dialog").dialog("close"); 
       } 
      }] //end buttons 
     }); //end dialog 


    }) 

</script> 

<body> 
<div class="page"> 
     <table> 
     <tr><td> 
     <table id="tblMain" border="1" align="center"></table> 
     </td></tr> 
     <tr><td> 
     <table> 
      <tr> 
       <td align="right"> 
        <button id="btnAttach" class="button"> 
         Additional Info</button> 
       </td> 
      </tr> 
     </table> 
     </td></tr></table> 

     <div id="dialog" title="Attach Contracts"> 
     <table><tr><td> 
     <table id="tblAttachment" border="1" align="center"> 
       <tr><td></td></tr> 
     </table> 
     </td></tr></table> 

     </div>   
</div> 
</body> 
+0

明天早上我會研究問題的下一件事 - 同時,你能告訴我們你正在使用哪個版本的jQuery和jQuery UI嗎? 我懷疑如果有問題,它可能是由在jQuery UI對話框中的網格的組合引起的。 –

+0

您是否嘗試過使用Ignite UI對話框而不是jQuery UI對話框?如果結果有任何變化,您能否告訴我們? –

回答

1

我認爲問題是由將焦點從輸入更改爲該對話框引起的。只需將trackFocus屬性設置爲false即可。

//Initialize 
$(".selector").igDialog({ 
    trackFocus: false 
});