2017-04-13 126 views
0

我有查看顯示使用jqgrid的文檔列表。當我點擊網格中的文檔標題時,我創建了一個帶有局部視圖的彈出窗口,並在這個局部視圖中使用了Kendo選項卡。在其中一個選項卡中,我使用局部視圖來加載顯示所有文檔日誌的jqgrid,並且在此網格中,我的navgrid無法工作。當我點擊下一個按鈕導航到下一個頁面時,它實際上是瀏覽我擁有文檔列表的主頁面。爲了避免混淆,我在局部視圖中爲navgrid使用了不同的'id',但是它根本沒有顯示下一個和上一個按鈕。任何人都可以指導我如何在不影響父視圖的情況下向分部視圖添加分頁。jqgrid navgrid不在標籤內工作

下面是主視圖中的jqGrid代碼:

$.ajax(
    { 
     type: "GET", 
     url: "@Url.Action("GetDocumentFileList", "Document")", 
     data: "", 
     dataType: "json", 
     success: function (data) { 
      if (data == "SessionTimeOut") 
       window.location.href = '@Url.Action("SessionTimeOut", "Error")'; 
      var page = data.Page; 
      var rows = data.Rows; 
      var colModel = eval(data.Columns); 
      var colNames = eval(data.ColumnsTitle); 
      var $grid = $("#datagrid"); 
      $grid.jqGrid({ 
       url: "@Url.Action("GetDocumentFileList", "Document")", 
       datatype: griddataType, 
       datastr: rows, 
       colNames: colNames, 
       colModel: colModel, 
       gridComplete: initGrid, 
       rowList: [25, 50, 75, 100], 
       ignoreCase: true, 
       width: null, 
       shrinkToFit: true, 
       multiselect: true, 
       multiboxonly: false, 
       pager: '#navGrid', 
       sortname: 'DocumentRegisterID', 
       sortorder: "desc", 
       scrollerbar: true, 
       viewrecords: true, 
       rowNum: 25, 
       autowidth: true, 
       ondblClickRow: function (DocumentRegisterID) { 
        if (DocumentRegisterID && DocumentRegisterID !== lastsel2) { 
         $grid.jqGrid('restoreRow', lastsel2); 
         $grid.jqGrid('editRow', DocumentRegisterID, true, null, successFuncStandardGrid); 
         lastsel2 = DocumentRegisterID; 
        } 
       }, 
       editurl: "@Url.Action("EditDocumentNo", "Document")", 
       hoverrows: true, 
       onSelectRow: function() { 
        return false; 
       }, 

這裏是在主視圖彈出使用的局部視圖中的jqGrid代碼:

$.ajax(
{ 
    type: "GET", 
    url: "@Url.Action("DocHistoryEventLog", "Document")", 
    data: '', 
    success: function (data) { 
     var page = data.Page; 
     var rows = data.Rows; 
     var $grid = $("#dataeventgrid"); 
     $grid.jqGrid({ 
      url: "@Url.Action("DocumentRegisterHistoryEventLogList", "Document", new { id = @docId })", 
      datatype: "json", 
      datastr: rows, 
      colNames: ['DocumentRegisterEventLogID', 'Event Type', 'Description', 'Revision', 'Version', 'Log By', 'Log Date', 'Organization Name', 'Document Owner Organization'], 
      colModel: [ 
       { name: 'DocumentRegisterEventLogID', index: 'DocumentRegisterEventLogID', key: true, hidden: true }, 
       { name: 'EventType', index: 'EventType', width: "20%", resizable: true }, 
       { name: 'EventDescription', index: 'EventDescription', sorttype: 'text', width: "20%", resizable: true }, 
       { name: 'Revision', index: 'Revision', width: "15%", sorttype: 'text', resizable: true }, 
       { name: 'DocVersion', index: 'DocVersion', width: "20%", resizable: true }, 
       { name: 'LogBy', index: 'LogBy', sorttype: 'text', width: "20%", resizable: true }, 
       { 
        name: 'StrLogDate', index: 'StrLogDate', sorttype: 'text', width: "25%", resizable: true, 
        searchoptions: { sopt: ["eq", "ne", "lt", "le", "gt", "ge"], dataInit: initDatepicker }, 
       }, 
       { name: 'OrganizationName', index: 'OrganizationName', sorttype: 'text', width: "20%", resizable: true }, 
       { name: 'DocumetOwnerOrganizationName', index: 'DocumetOwnerOrganizationName', width: "20%", sorttype: 'text', resizable: true }, 
      ], 
      rowList: [15, 30, 45, 100], 
      loadonce: false, 
      shrinkToFit: true, 
      ignoreCase: true, 
      pager: '#navLogGrid', 
      autoencode: true, 
      sortname: 'DocumentRegisterEventLogID', 
      sortorder: "desc", 
      viewrecords: true, 
      rowNum: 15, 
      width: 850, 
      height:270, 
      gridview: true, 
      height: "auto", 
      scrollerbar: true, 
      loadComplete: function() { 
       highlightFilteredData.call(this); 

      }, 
      loadError: function (jqXHR, textStatus, errorThrown) { 
       alert('HTTP status code: ' + jqXHR.status + '\n' + 
         'textStatus: ' + textStatus + '\n' + 
         'errorThrown: ' + errorThrown); 
       alert('HTTP message body (jqXHR.responseText): ' + '\n' + jqXHR.responseText); 
      } 
     }); 

     $grid.jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn", stype: 'select' }); 
     $grid.jqGrid("navGrid", "#navLogGrid", { add: false, edit: false, del: false, search: false, refresh: true }); 
     $grid.parents('div.ui-jqgrid-bdiv').css("max-height", '270px'); 

回答

0

設置屬性loadonce:真正在我的部分觀點解決了我的問題。謝謝