你好,这个需求用事件可以解决,参考以下代码:
- import 'bootstrap.css';
- import '@grapecity/wijmo.styles/wijmo.css';
- import './styles.css';
- import * as wjGrid from '@grapecity/wijmo.grid';
- import * as wjCore from '@grapecity/wijmo';
- //
- document.readyState === 'complete' ? init() : window.onload = init;
- //
- function init() {
- //
- // create some random data
- var countries = 'US,Germany,UK,Japan,Sweden,Norway,Denmark'.split(',');
- var data = [];
- for (var i = 0; i < countries.length; i++) {
- data.push({
- id: i,
- country: countries[i],
- sales: Math.random() * 10000,
- expenses: Math.random() * 5000,
- overdue: (i + 1) % 4 == 0
- });
- }
- //
- // show the data in a grid
- var theGrid = new wjGrid.FlexGrid('#theGrid', {
- itemsSource: data,
- columns: [
- { binding: 'id', header: 'ID', width: 50, isReadOnly: true },
- { binding: 'country', header: 'Country', isRequired: true, dataMap: countries },
- { binding: 'sales', header: 'Sales', format: 'n2' },
- { binding: 'expenses', header: 'Expenses', format: 'n2' },
- { binding: 'test', header: 'Test', format: 'n2' },
- { binding: 'overdue', header: 'Overdue' }
- ],
- cellEditEnded: function (s, e) {
- var col = s.columns[e.col];
- var row = e.row;
- if (col.binding == 'sales') {
- console.log('编辑结束,跳转到Test')
- setTimeout(()=>{
- s.selection = new wjGrid.CellRange(row, e.col+2, row, e.col+2);
- })
- }
- }
- });
- //
- // show log message
- var elLog = document.getElementById('log');
- function showMessage(msg) {
- elLog.innerHTML = msg;
- }
- }
复制代码
测试地址:
https://demo.grapecity.com.cn/wi ... ents/Editing/purejs
替换app.js后,编辑Sales列可以看到效果。 |