- GridUtil.CellKeyDown = function(spdID) {
- var spd = document.getElementById(spdID);
- if (event.keyCode == 13) {
- var colCount = spd.GetColCount();
- var rowCount = spd.GetRowCount();
- var activecol = spd.ActiveCol;
- var activerow = spd.ActiveRow;
- var tempACol = activecol;
- var tempARow = activerow;
- var tempRowAdd = 0;
- var tempWhiteCol = -1;
- var isCheckWhite = false;
- if (rowCount <= 0) {
- // var e = event ? event : window.event;
- // try { e.keyCode = 9; } catch (ex) { }
- return;
- }
- activecol++;
- if (activecol >= colCount) {
- activerow++;
- activecol = 0;
- }
- if (activerow >= rowCount) {
- activerow = 0;
- }
- if (activecol < colCount) {
- while (activecol < colCount) {
- if (spd.Cells(activerow, activecol).getAttribute("FpCellType") == 'readonly') {
- if (spd.Cells(activerow, activecol).GetBackColor() == '#f0f0f0') {
- isCheckWhite = true;
- tempWhiteCol = -1;
- } else if (isCheckWhite) {
- tempWhiteCol = activecol;
- isCheckWhite = false;
- }
- activecol++;
- } else {
- break;
- }
- if (activecol >= colCount) {
- activerow++;
- activecol = 0;
- tempRowAdd++;
- }
- if (activerow >= rowCount) {
- activerow = 0;
- }
- if (tempRowAdd > 1) {
- activecol = tempACol + 1;
- activerow = tempARow;
- if (activecol < colCount && spd.Cells(activerow, activecol).GetBackColor() == '#f0f0f0' && tempWhiteCol > 0) {
- activecol = tempWhiteCol;
- }
- break;
- }
- }
- }
- spd.EndEdit();
- if (activecol < colCount) {
- spd.SetActiveCell(activerow, activecol);
- } else {
- spd.SetActiveCell(activerow + 1, 0);
- }
- }
- }
复制代码
实现了,感谢大家! |