iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Webgrid have a column which is "NoEdit" !
<ISWebGrid:WebGridColumn Width="60px" EditType="NoEdit" Name="idxBox" Caption="myname" > </ISWebGrid:WebGridColumn>
When focus on "myname" column, I Press Enter Key,can not tun into next cell !How can I do to tun into next cell when have a "NoEdit" column???function WebGrid1_OnEditKeyDown(controlId, tblName, rowIndex, cellIndex) { var grid = ISGetObject(controlId); var totalRows = grid.TotalRows; var curRow = grid.GetSelectedObject().rowIndex; var curCell = grid.GetActiveEditCell().cellIndex; var activeCell = grid.GetActiveEditCell(); if (activeCell.rowElement.type == "Record") { if (event.keyCode == 37)//左键左移 { if (curCell != 1)//不是第一单元,则在该行左移 { MoveAndSelectCell(curRow, curCell - 2); } else//如果是第一单元并且不是第一行则上移一行 { if (curRow != 0) { MoveAndSelectCell(curRow - 1, 3); } } } if (event.keyCode == 39)//右键右移 { if (curCell != 8)//不是最后单元则在该行移 { MoveAndSelectCell(curRow, curCell); } else { if (curRow != (totalRows - 1))//不是最后一行,则下移一行. { MoveAndSelectCell(curRow + 1, 1); } } } if (event.keyCode == 38)//下键上移 { alert('up'); } if (event.keyCode == 40)//下键下移 { if (curRow < (totalRows - 1))//如果不是最后一行,则下移一行 { // if (curCell != 4) { // MoveAndSelectCell(curRow + 1, curCell-1); // // // } else { // var WebCombo1 = ISGetObject("WebCombo1"); // window.setTimeout(function() { WebCombo1.ShowDropDown(true); }, 100); // } } } if (event.keyCode == 13)//如果是回车 { if (curCell == 8) { if (curRow == (totalRows - 1)) { var newRow = grid.RootTable.NewRow(); var newCells = newRow.GetCells(); newCells.GetNamedItem("vouid").SetText(totalRows + 1, true); newCells.GetNamedItem("商品编号").SetText("", true); newCells.GetNamedItem("商品名称").SetText("", true); newCells.GetNamedItem("商品规格").SetText("", true); newCells.GetNamedItem("包装单位").SetText("", true); newCells.GetNamedItem("数量").SetText("", true); newCells.GetNamedItem("价格范围").SetText("", true); newCells.GetNamedItem("备注").SetText("", true); newRow.Update(); window.setTimeout(function() { SelectNextRow(curRow + 1); }, 1000); } else { var nextCell = grid.RootTable.GetRow(curRow + 1).GetCell(1); grid.SetFocus(); grid.RootTable.GetRow(curRow + 1).Select(); nextCell.ActivateEdit(); } event.keyCode = null; } else { event.keyCode = 9; } } } return true; }
function WebGrid1_OnEditKeyDown(controlId, tblName, rowIndex, cellIndex) { var grid = ISGetObject(controlId); var totalRows = grid.TotalRows; var curRow = grid.GetSelectedObject().rowIndex; var curCell = grid.GetActiveEditCell().cellIndex; var activeCell = grid.GetActiveEditCell(); if (activeCell.rowElement.type == "Record") { if (event.keyCode == 37)//左键左移 { if (curCell != 1)//不是第一单元,则在该行左移 { MoveAndSelectCell(curRow, curCell - 2); } else//如果是第一单元并且不是第一行则上移一行 { if (curRow != 0) { MoveAndSelectCell(curRow - 1, 3); } } } if (event.keyCode == 39)//右键右移 { if (curCell != 8)//不是最后单元则在该行移 { MoveAndSelectCell(curRow, curCell); } else { if (curRow != (totalRows - 1))//不是最后一行,则下移一行. { MoveAndSelectCell(curRow + 1, 1); } } } if (event.keyCode == 38)//下键上移 { alert('up'); } if (event.keyCode == 40)//下键下移 { if (curRow < (totalRows - 1))//如果不是最后一行,则下移一行 { // if (curCell != 4) { // MoveAndSelectCell(curRow + 1, curCell-1); // // // } else { // var WebCombo1 = ISGetObject("WebCombo1"); // window.setTimeout(function() { WebCombo1.ShowDropDown(true); }, 100); // } } } if (event.keyCode == 13)//如果是回车 { if (curCell == 8) { if (curRow == (totalRows - 1)) { var newRow = grid.RootTable.NewRow(); var newCells = newRow.GetCells(); newCells.GetNamedItem("vouid").SetText(totalRows + 1, true); newCells.GetNamedItem("商品编号").SetText("", true); newCells.GetNamedItem("商品名称").SetText("", true); newCells.GetNamedItem("商品规格").SetText("", true); newCells.GetNamedItem("包装单位").SetText("", true); newCells.GetNamedItem("数量").SetText("", true); newCells.GetNamedItem("价格范围").SetText("", true); newCells.GetNamedItem("备注").SetText("", true); newRow.Update(); window.setTimeout(function() { SelectNextRow(curRow + 1); }, 1000); } else { var nextCell = grid.RootTable.GetRow(curRow + 1).GetCell(1); grid.SetFocus(); grid.RootTable.GetRow(curRow + 1).Select(); nextCell.ActivateEdit(); } event.keyCode = null; } else { event.keyCode = 9; } } } return true; }
Using a simplified snippet with only the enter key conditional I have no such issue on my test page in my environment. Attached is the test page I am using, you will need to have northwind.mdb which is available from the provided Intersoft WebGrid sample.
I am also using the latest WebGrid 7 and WebUI Framework 3, build 404 and 755 respectively.
Thank you,Glenn Layaar.The problem has solved.
I was mistaken that "Get first cell" by "grid.RootTable.GetRow(curRow).GetCell(1);" in the past.Now I chang a little code ,it work perfect :
function wgTest_OnKeyDown(controlId, tblName, rowIndex, cellIndex) { var grid = ISGetObject(controlId); var totalRows = grid.TotalRows; var curRow = grid.GetSelectedObject().rowIndex; var curCell = grid.GetActiveEditCell().cellIndex-1; var activeCell = grid.GetActiveEditCell(); if (activeCell.rowElement.type == "Record") { if (event.keyCode == 13) { if (curCell == grid.RootTable.Columns.length-1) { grid.SetFocus(); grid.RootTable.GetRow(curRow + 1).Select(); var nextCell1 = grid.RootTable.GetRow(curRow + 1).GetCell(0); nextCell1.ActivateEdit(); } else { grid.SetFocus(); grid.RootTable.GetRow(curRow).Select(); var nextCell = grid.RootTable.GetRow(curRow).GetCell(curCell+1); nextCell.ActivateEdit(); } } return true; } }
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname