jquery - navGrid 不与 JQGrid 一起使用

标签 jquery asp.net-mvc jqgrid

我有一个 asp.net MVC 应用程序,我正在尝试让 jqgrid 3.5 在其中工作。我的网格不使用分页功能,但我想使用页面导航栏作为编辑按钮。我的网格位于内容页面上的 jquery 选项卡控件中。在网格中显示我的数据工作正常,但是当我添加 .navGrid() 扩展名和选项时,它会破坏网格的显示(选项卡消失)并且不显示任何按钮。这是我的网格声明 - 任何人都可以看到我缺少什么。或者有没有办法确定是什么导致了这个问题。我非常渴望让它发挥作用 - 提前致谢。

<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();
});

最佳答案

好的 - 尝试使用其他发布的示例中的语法并让它工作 - 注意没有 View 选项。

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

关于jquery - navGrid 不与 JQGrid 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1435001/

相关文章:

css - 在 IE11 企业模式或兼容模式下清除字段 'x'

asp.net-mvc-4 - jqgrid 复选框全选、全部清除

java - 从另一个表填充 SQL 表列

javascript - 通过不显眼的验证以 asp.net mvc 形式动态添加 bootstraph glyphicon

JQuery Mobile - 隐藏下拉选项

javascript - 有没有办法在 jQuery Datepicker 上同时使用相对和绝对年份范围?

javascript - 经过一段时间间隔后滚动到 anchor

jquery - 不使用模型的 ASP.NET MVC ajax 服务器端验证

c# - Asp.Net MVC 应用程序问题 - 无法加载 'System.Diagnotics.Tracing'

asp.net-mvc - 在 Entity Framework 中使用存储过程