您好,这个不影响的,您可以用ES5的语法来实现,示例代码如下:
- onload = function() {
- // create some random data
- var countries = 'US,Germany,UK,Japan'.split(',');
- var data = [];
- for (var i = 0; i < 20; i++) {
- data.push({
- id: i,
- country: countries[i % countries.length],
- sales: Math.random() * 10000,
- expenses: Math.random() * 5000,
- overdue: i % 4 == 0
- });
- }
- // bind a grid to the data
- var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
- itemsSource: new wijmo.collections.CollectionView(data, {
- groupDescriptions: [ 'country' ] // group data by country
- }),
- formatItem: function(s, e) { // add 'button' to country cells
- if (e.panel == s.cells) {
- if (s.columns[e.col].binding == 'country') {
- var html = '<span class="my-button">⬤</span> ' + e.cell.innerHTML;
- e.cell.innerHTML = html;
- }
- }
- }
- });
-
- theGrid.addEventListener(theGrid.hostElement, 'mouseover', function(e) {
- var ht = theGrid.hitTest(e);
- var cellType = ht.cellType;
- // 判断是否为列头的cellType
- if(cellType === 2){
- console.log(theGrid.getClipString(ht.range, true, true));
- }
- });
- }
复制代码
|