【问题标题】:jqGrid integration with existing Durandal solutionjqGrid 与现有 Durandal 解决方案的集成
【发布时间】:2018-05-18 09:32:28
【问题描述】:

我正在尝试使用 Durandal 将 jqGrid 集成到我的解决方案中,以在网格视图中显示来自 dB 的记录,并具有向网格添加可编辑行的能力。在查看了几个示例后,我开始执行但收到错误“未捕获的错误:无法加载路由模块(viewmodels/jqGridBinding)。详细信息:对象 [object Object] 没有方法 'jqGrid'”。

我的视图文件是 (jqGridBinding.html)

<section>
    <table id="list2"></table>
    <div id="pager2"></div>
</section>

我的视图模型类是 jqGridBinding.js 定义(函数(){

jQuery("#list2").jqGrid({
    url: '/api/incidents',
    type: 'GET',
    data: { page: "1", rows: "20" },
    dataType: 'json',
    colNames: ['IncidentId', 'Title', 'Description'],
    colModel: [
        { name: 'Id', index: 'Id', width: 55 },
        { name: 'Title', index: 'Title', width: 90 },
        { name: 'Description', index: 'Description', width: 100 }
    ],
    rowNum: 10,
    rowList: [10, 20, 30],
    pager: '#pager2',
    sortname: 'id',
    viewrecords: true,
    sortorder: "desc",
    caption: "JSON Example"
});`


jQuery("#list2").jqGrid('navGrid', '#pager2', { edit: false, add: false, del: false });

});

有人可以调查这个问题并提出任何解决方案吗?感谢任何输入。

【问题讨论】:

标签: jquery jqgrid durandal


【解决方案1】:

检查它在 durandal 中是否有工作的 jqgrid

http://durandal-playground.azurewebsites.net/#/jqGrid-sample

谢谢,

【讨论】:

  • 很棒的样品!是开源的吗?
  • Davi,您可以从 durandal 网站durandaljs.com/downloads.html 获得更多样品。它没有像之前问的那样覆盖 jqgrid。但我也可以通过使用 HTML Samples.zip 的 main.js 文件中的以下更改来呈现 jqgrid。在 requirejs.config({ main.js. 的设置 ,'jqgridlocale': 'trirand.com/blog/jqgrid/js/i18n/grid.locale-en' ,'jqgrid': 'trirand.com/blog/jqgrid/js/jquery.jqGrid.min' 中添加了以下更改
  • 并在 index.html 中添加了类似的相关样式 ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/redmond/…" type="text/css" rel="stylesheet">
猜你喜欢
  • 2019-07-25
  • 2012-07-13
  • 1970-01-01
  • 2018-10-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-05
相关资源
最近更新 更多