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
I have a grid with a column named "Sort Order". The user can make a change to this text field. When the field is changed, we need to validate it. On the OnAfterExitEditMode, we do the validation of the cell. Depending on this value, I may have to change other rows.
At the bottom of the grid is shows the correct pending change(s); however, when I try to view them. I get an error in 305000803.js on " if
"
vd0b48 is undefined.
If I don't select this and try to apply my changes I get a communication error.
Here is the aspx code:
function OnCellValidate(controlId, tblName, editObject) { AddToCounter(); var grid = ISGetObject(controlId); var rootTable = grid.RootTable; if (editObject != null) { var cell = wgGetCellByElement(editObject.cellElement); if (cell.GetRow().Type != "FilterRow") { var cellObject = editObject.ToCellObject(); var selectedObject = grid.GetSelectedObject(); var selectedRow = selectedObject.ToRowObject(); // return WebGridRow object var colName = cell.Name; var row = cell.Row; var OrigValue = Trim(cell.OldText); var NewValue = Trim(cell.Value); switch (colName) { case "SortOrder": if (controlId == DetailColumnGrid) { ChangeSortOrder(controlId, NewValue); row.GetCells().GetNamedItem(colName).SetText(NewValue, true); row.GetCells().GetNamedItem(colName).SetValue(NewValue); } break; default: break; } if (OrigValue != NewValue && selectedRow.Type != "NewRow") { cellObject.CellElement.style.fontWeight = "bold" selectedRow.SetDataChanged(); grid.MarkEdit(); } } } return true; } function ChangeSortOrder(controlId, OrderNum) { var grd = ISGetObject(controlId); if (grd == null) return; var rows = grd.RootTable.GetElement(WG40.BODY, WG40.HTMLTABLE).getElementsByTagName("tr"); // iterate through all rows for (var i = 0; i < rows.length; i++) { if (rows[i].type == "Record") { if (parseInt(grd.GetRootTable().GetRow(i).GetCells().GetNamedItem("SortOrder").Value) >= parseInt(OrderNum)) { //alert(parseInt(grd.GetRootTable().GetRow(i).GetCells().GetNamedItem("SortOrder").Value)); var newVal = parseInt(grd.GetRootTable().GetRow(i).GetCells().GetNamedItem("SortOrder").Value) + 1; newVal = newVal.toString(); grd.GetRootTable().GetRow(i).GetCells().GetNamedItem("SortOrder").SetText(newVal, true); grd.GetRootTable().GetRow(i).GetCells().GetNamedItem("SortOrder").SetValue(newVal, true); grd.GetRootTable().GetRow(i).SetDataChanged(); grd.GetRootTable().GetRow(i).AddPendingChanges(); } } } }
I tried to reproduce the reported problem by creating a simple page based on the provided snippet code. In the test page, I simply modify a cell’s text by using SetText(param1, param2) method; invoking SetDataChanged(); and AddPendingChanges(). Unfortunately, I was unable to view the pending changes without any issues.
I’m willing to advise you further but in order to do so I would need you to elaborate on your specific scenario and possibly provide me a step by step guide that I can use to observe the problematic behavior.
I created an example of what I'm doing.
Here are the steps to recreate:
1) put a 1 the Sort Order column for row 4.
2) tab off
3) The pending changes should be showing 4 pending changes b/c Sort Order was changed for 4 rows.
4) Click the Review Pending changes. You get an error that I referenced above.
"if(vd0b48.substring(0,1)=="/" ||vd0b48.substring(0,1)=="." ||
"vd0b48 is undefined. "
5) Try to apply all changes by clicking the batch update button on the grid and you get error that I have also attached.
I used your WebGridSamples.sln to create this test.
We are using the current WebGrid.
Hello,Thank you for your sample and guidance.I try to run your sample and I can replicate your issue on my end as well.To fix this issue please try to remove this line of code in ChangeSortOrder function:
grd.GetRootTable().GetRow(i).AddPendingChanges();
Please have review on my sample and see how it works.Thank you.Regards,Hans.
This still isn't giving me what I need.
I took pictures of what I see based on the steps.
Step 1 pic- shows that I'm editing row 4. When I tab off it will update Row 1, 2, 3 with new sort order numbers.
Step 2 pic - Shows that the rows 1-4 have been updated but I only see 1 Pending Change(s). I'm expecting to see 4.
Step 4 pic - Shows in the Review Changes I only have one row changed. When I'm expecting to see 4.
I'm using your example WebGrid_PendingChanges_Issue.aspx
I made a minor modification on Hans Kristian’s sample. WebGrid is bound to SqlDataSource control. The data is taken from ChangeRowSample table of SqlSample.mdf database file. Some lines of JavaScript code is removed and some lines of them is converted to use WebGrid’s API.
Please have the modified sample evaluated on your end and let us hear your feedback.
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