本文介绍了w2ui与jQuery 3.1.1网格不显示记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使w2ui网格具有页面上显示的一些数据.但是,如果我使用jquery 3.1.1,则会呈现并显示网格,但不会显示记录(重新加载按钮会使它们出现,但这不是解决方案).

I'm trying to make w2ui grid with some data in it shown on page. But if I use jquery 3.1.1 grid is rendered and shown, but records are not shown (reload button make them appear but that's not a solution).

我的代码:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8"/>
  <script src="w2ui/jquery-3.1.1.js"></script>
  <script type="text/javascript" src="w2ui/w2ui-1.5.rc1.js"></script>
  <link rel="stylesheet" type="text/css" href="w2ui/w2ui-1.5.rc1.css" />
</head>
<body>
  <div id="main" style="width:98vw; height: 98vh;  margin:0 auto"></div>
  <script type="text/javascript">
  var grid2 = {
    grid: {
      name: 'grid',
      selectType: 'cell',
      style:'font-size:xx-small',
      show: {
        toolbar: true,
        footer: true,
      },
      columns: [
        {field:'code', caption:'Code', size:'5%', resizable: false},
        {field:'name', caption:'Name', size:'20%', resizable: false},
        {field:'f1', caption:'Field1', size:'5.35%', resizable: false}
      ],
      records:[
        {recid: 0, code: '34072', name: 'Name1'},
        {recid: 1, code: '00372', name: 'Name2'},
        {recid: 2, code: '30402', name: 'Name3'},
      ]
    }
  };
  $(document).ready(
    function () {
      //w2utils.locale('w2ui/locale/ru-ru.json');
      $('#main').w2grid(grid2.grid);
    }
  );
</script>
</body>
</html>

推荐答案

这似乎是w2ui 1.5 rc1的问题(小提琴: http://jsfiddle.net/0gvujdm3/1/)

This seems to be an issue with w2ui 1.5 rc1 (fiddle: http://jsfiddle.net/0gvujdm3/1/ )

如果将源更新为最新的w2ui 1.5(每晚更新),您将看到不再出现此问题(提琴 http://jsfiddle.net/0gvujdm3/)

If you update the sources to the latest w2ui 1.5 (nightly master), you will see that this problem no longer occurs (fiddle http://jsfiddle.net/0gvujdm3/ )

Since I can't post fiddle links w/o also posting code, 
here's some extra content to this answer.

注意:当前,w2ui拾色器输入在夜间主设备中已损坏(但在1.5 rc1中工作正常).

Note: Currently the w2ui color picker input is broken in the nightly master (but works fine in 1.5 rc1).

这篇关于w2ui与jQuery 3.1.1网格不显示记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 00:53