如图,嵌套表里面有50行数据,动态生成的,用code展开,整个grid都不自动生成column。
一点击展开时,数据加载一半,延迟了几百毫秒,再显示全部内容,
请问这大概是什么方面的原因引起的?我排查一下。
恕我无法贴源代码,但是自己写的Demo又重现不出来。
2.
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title></title>
- <!--jQuery References-->
- <script src="http://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script>
- <!-- Wijmo references (required) -->
- <script src="http://cdn.wijmo.com/5.20152.84/controls/wijmo.min.js" type="text/javascript"></script>
- <link href="http://cdn.wijmo.com/5.20152.84/styles/wijmo.min.css" rel="stylesheet" type="text/css" />
- <!-- Wijmo controls (optional, include the controls you need) -->
- <script src="http://cdn.wijmo.com/5.20152.84/controls/wijmo.grid.min.js" type="text/javascript"></script>
- <script src="scripts/wijmo.grid.detail.min.js"></script>
- <script src="scripts/wijmo.odata.min.js"></script>
- <script type="text/javascript">
- var countryData, statesData;
- $(document).ready(function () {
- var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(',');
- var cdata = [];
- for (var i = 0; i < 5; i++) {
- cdata.push({
- cid: i,
- country: countries[i % countries.length],
- date: new Date(2014, i % 12, i % 28),
- amount: Math.random() * 10000,
- active: i % 4 === 0
- });
- }
- var sdata = [];
- for (var i = 0; i < 5; i++) {
- sdata.push({
- sid: i,
- state: 'none',
- date: new Date(2014, i % 12, i % 28),
- amount: Math.random() * 10000,
- active: i % 4 === 0
- });
- }
-
- // get categories and products from server
- countryData = new wijmo.collections.CollectionView(cdata);
- statesData = new wijmo.collections.CollectionView(sdata);
- // initialize detail visibility mode
- //var detailMode = wijmo.grid.detail.DetailVisibilityMode.ExpandSingle;
- var grid = new wijmo.grid.FlexGrid('#gsFlexGrid');
- grid.itemsSource = countryData;
- var dp = new wijmo.grid.detail.FlexGridDetailProvider(grid);
- dp.createDetailCell = function (row) {
- var cell = document.createElement('div');
- grid.hostElement.appendChild(cell);
- var detailGrid = new wijmo.grid.FlexGrid(cell, {
- headersVisibility: wijmo.grid.HeadersVisibility.Column,
- autoGenerateColumns: false,
- itemsSource: sdata,
- columns: [
- { header: 'ID', binding: 'sid' },
- { header: 'State', binding: 'state' },
- { header: 'Date', binding: 'date' },
- { header: 'Amount', binding: 'amount' },
- { header: 'Active', binding: 'active' }
- ]
- });
- return cell;
- };
- var i=0;
- grid.formatItem.addHandler(function(grid,event){
- console.log(i++);
- });
- });
-
- </script>
- </head>
- <body>
- <div id="gsFlexGrid"></div>
- </body>
- </html>
复制代码 上面这段代码渲染的时候为什么wijmo要重新渲染3次?我的第一个问题是不是这个原因引起的?
如图所示:
|