2009-09-16 129 views
2

我有一個asp.net MVC應用程序,我試圖讓jqgrid 3.5在其中工作。我的網格不使用分頁功能,但我想使用頁面導航欄來編輯按鈕。我的網格在內容頁面上的jquery選項卡控件中。顯示我的數據在網格中工作正常,但是當我添加.navGrid()擴展名和選項時,它會中斷網格的顯示(標籤消失),並且不顯示任何按鈕。這是我的網格聲明 - 任何人都可以看到我錯過了什麼。或者有什麼方法可以確定是什麼導致了這種破壞。我非常沮喪地得到這個工作 - 在此先感謝。navGrid不能與JQGrid一起工作

<script type="text/javascript"> 
jQuery(document).ready(function() { 
    jQuery("#sandgrid").jqGrid({ 
     url: '/EquipTrack/GridData/', 

    editurl: '/EquipTrack/Edit/', 
     datatype: 'json', 
     mtype: 'GET', 

     height: 255, 
     width: 755, 
     rowNum: 5000, 
     colNames: ['ID', 'Type', 'Make', 'Model', 'Year', 'Location', 'Insp Due', 'Serv Due', 'Miles/Hrs', 'Milage Dt', 'Reg By', 'Mngd By', 'Tag Exp',''], 
     colModel: [ 
     { name: 'equip_id', index: 'equip_id', width: 65, editable: true }, 
     { name: 'type_desc', index: 'type_desc', width: 130, editable: true }, 
     { name: 'make_descr', index: 'make_descr', width: 80, editable: true }, 
     { name: 'model_descr', index: 'model_descr', width: 80, editable: true }, 
     { name: 'equip_year', index: 'equip_year', width: 60, editable: true }, 
     { name: 'work_loc', index: 'work_loc', width: 130, editable: true }, 
     { name: 'insp_due_dt', index: 'insp_due_dt', width: 100, editable: true }, 
     { name: 'service_due_num', index: 'service_due_num', width: 80, editable: true }, 
     { name: 'miles_hours', index: 'miles_hours', width: 80, editable: true }, 
     { name: 'miles_dt', index: 'miles_dt', width: 100, editable: true }, 
     { name: 'registered_by', index: 'registered_by', width: 80, editable: true }, 
     { name: 'managed_by', index: 'managed_by', width: 80, editable: true }, 
     { name: 'tag_expire_dt', index: 'tag_expire_dt', width: 100, editable: true }, 
     { name: 'inspection_warn', index: 'tag_expire_dt', width: 0, hidden:true}], 

     sortname: 'equip_id', 
     sortorder: "asc", 
     afterInsertRow: function(rowid, rowdata, rowelem) { 
      if (rowelem[13] == 'SET_RED') { 
       jQuery("#sandgrid").setCell(rowid, 'insp_due_dt', '', { color: 'red' }) 
      } 
     }, 
     viewrecords: true, 
     pager: jQuery('#sandgridp'), 
     caption: 'Inventory' 

    }).navGrid('#sandgridp', 
    {view:true}, //options 
     {height:290,reloadAfterSubmit:false, jqModal:false, closeOnEscape:true, bottominfo:"Fields marked with (*) are required"}, // edit options 
     {height:290,reloadAfterSubmit:false,jqModal:false, closeOnEscape:true,bottominfo:"Fields marked with (*) are required"}, // add options 
     {reloadAfterSubmit:false,jqModal:false, closeOnEscape:true}, // del options 
     {closeOnEscape:true}, // search options 
     {height: 250, jqModal: false, closeOnEscape: true} // view options 
    ); 

    $('#sandgridp_center').remove(); 
    $('#sandgridp_right').remove(); 
}); 

回答

2

OK - 試着用其他的語法玩貼例子,得到它的工作 - 發現沒有視圖選項。

}).navGrid('#sandgridp', 
{}, //options 
{reloadAfterSubmit:false}, // edit options 
{reloadAfterSubmit:false}, // add options 
{reloadAfterSubmit:false}, // del options 
{} // search options 
); 
2

確保您在下載中包含表單編輯搜索功能;否則,navGrid函數將不會被定義。

+0

+1非常好的一點:) – Jimbo 2010-10-27 09:50:59