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
Currently I'm working with a SmartBatchUpdateScenario. However, the possibility exists that a record gets added with a duplicate KeyValue. The WebGrid gives me a decent error message about that, but I'd like to detect that in advance and suppress the message. The message is not relevant for users in my case.
So my first solution to detect that case was to loop through all grid rows and check each keyvalue to the keyvalue of the record to be added. If a match is found, the record is not added. I'm encountering one problem hereby: the number of grid rows isn't returning the correct number of rows.
Concrete steps:
I'm using the attachment from this thread: http://www.intersoftpt.com/Community/WebGrid/WebGrid-two-way-binding-issue/. Several ways to get the row count:
var grid = ISGetObject("WebGrid1");alert(grid.TotalLoadedRows); // Doesn't change after record has been added at client side.alert(grid.TotalRows);// Doesn't change after record has been added at client side.alert(grid.RootTable.Rows); // Is null.alert(grid.RootTable.Rows.length); // Throws error.
Questions:
Thanks in advance.
I did not found any attachment in your post. However based on my test on your scenario, you could use the GetRowByKeyValue client side function to determine if the row your are going to add has already exist. The function will return null if the row does not exist.
Here is a snippet:
grid.RootTable.GetRowByKeyValue(KeyValue);
In the provided sample BatchUpdate_Enterprise.aspx, I have tried the scenario you described, adding multiple row with duplicate KeyValue. However, internal WebGrid validation on every pending changes will already disallow such operation.
In your scenario, which event handler are you using in an attempt to cancel the row addition? In your scenario, does the message occur after each pending changes or after accept all changes occurs?
Hi Glenn,
It actually concerns sample BatchUpdate1.aspx in the attached Batch.zip.
Let me describe the situation a little more. The webgrid is currently used in combination with a search box. The selected results (can be more than one), will be added to the 'container'/'selected results' webgrid. However, all results and record values will be added on clientside.
Because of clientside addition (user can't interact at this point), no eventhandler of the webgrid is used. The records will be added if the user makes the selection of search results final. So for me, this is a logical place to check the record already exists (correct me if I'm wrong).
If no check is applied or the check fails (as descriped in topic start), the WebGrid displays the message on the line where I call AddPendingChanges(). The message is: The pending changes already contain a record with key 'x'.
I hope this clearifies the situation and hope you'll have an idea of how to solve this problem.
Thanks in advance!
Nice solution, stupid I didn't realise this was an option too. Thanks!!
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