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 webgrid that I need to validate after they click off the row. Is there a way to undo changes for just certain cell values? I have tried row.UndoChanges(); but that will undo everything for the whole row. Is there some property like...
If (valid == false){
row.GetCells().GetNamedItem("Column1").UndoChanges(); row.GetCells().GetNamedItem("Column2").UndoChanges(); }
row.GetCells().GetNamedItem("Column2").UndoChanges();
}
Hi Jocelyn,
Unfortunately, we do not support that kind of property. However, there is a workaround for this scenario. First, we need to use a client side event of WebGrid_onEndRowEditing. Then, undo it by changing its old and new value of cell according to its validation. Here is the snippet to do so:
function WebGrid1_OnEndRowEditing(controlId, row) { var maxValue = 10; var WebGrid1 = ISGetObject(controlId); if (row.GetCells().GetNamedItem("UnitPrice").Get("Value") > maxValue) { row.GetCells().GetNamedItem("UnitPrice").SetValue(row.GetCells().GetNamedIte m("UnitPrice").Get("OldValue"), true); } else { row.GetCells().GetNamedItem("UnitPrice").SetValue(row.GetCells().GetNamedIte m("UnitPrice").Get("Value"), true); } return true; }
I hope it helps and please, do not hesitate to ask if you have any other questions. Thank you.
Best Regards,
Andi Santoso
When I do this, it still shows up in the ReviewChanges dialog window as a Pending change. Is there a way to clear it out of the Pending changes when I set it back to the orignal value.
Forgive me, but I am not able to replicate the issue. It means that you are using batchupdate right. After I edit a particular cell with an invalid data, then I clicked on the "Accept All Changes" button. After that, the value is getting back to its original value and no record is made on the ReviewChanges dialog window. I am wondering, where was I missing.
Attached is a simple sample using Northwind, Product database. Perhaps, you could modify it so that it will replicate the issue and send them back to me. Or maybe, you can send me video on how to replicate the issue. Thank you and have a nice day.
I am using BatchUpdate. I actually do not want to "Accept All Changes". Here is the scenario:
1. User enters a value.
2. In my function OnAfterExitEditMode, I check to see if the value is valid or not.
3. If it is invalid I set the cell value back to the Old value.
4. The problem is that the Review Changes still shows it has changed.
Hi Jocelyn
Have you tried my suggested snippet? Could you kindly try to put the validation under the OnEndRowEditing instead of OnAfterExitEditMode? I tried these on my sample and it works just fine.
I hope it helps and please do not hesitate to ask if you have any other questions. Thank you.
I have tried your snippet that you sent and it is not working. It does not work in either the OnEndRowEditing or OnAfterExitEditMode.
Could you kindly find and run my attached sample? It is using Product Northwind database. In there, you can the unit price value. It will be invalid if you insert the value is greater than 10. And could you tell me if it gives you a same result with your project ?
Thank you and have a nice day.
It does not set the cell back to the orginal value at all when I enter a value greater than 10.
I ran your example and it does not set the cell back to the orginal value at all when I enter a value greater than 10.
Here is a new snippet. Hopefully it will meet your scenario. If i am not mistaken, you want to set the value back to its original before the value goes to BatchUpDate. The problem is occurred because we are using BatchUpdate, it will hold the value first and all the changes will be made when we accept all changes. So, eventhough we set value to the old value, it will not change if the accept is not be made.
function WebGrid1_OnEndRowEditing(controlId, row) { var controlId = ISGetObject("WebGrid1"); var maxValue = 10; if (row.GetCells().GetNamedItem("UnitPrice").Get("Value") > maxValue) { row.GetCells().GetNamedItem("UnitPrice").SetValue(row.GetCells().GetNamedItem("UnitPrice").Get("OldValue"), true); controlId.AcceptAllChanges(); } else { row.GetCells().GetNamedItem("UnitPrice").SetValue(row.GetCells().GetNamedItem("UnitPrice").Get("Value"), true); } return true; }
I hope it helps. Thank you and have a nice day.
The problem is that I do not want to call the controlid.AcceptAllChanges(). This would make a call to the server side BatchUpdate method, which should not be called because it would save all changes that a user has made on the grid without them physically hitting the Save button. So, this is not an acceptable solution.
How do I request this as a feature enhancement?
Sorry for the inconvenience, however, you can ask for the feature request at "Developer Networked -> Community Center -> Product Feedback -> Feature Request". I hope it helps. Thank you and have a nice day.
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