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 where the user can add and delete rows. Upon adding and deleting I have a javascript function that updates some column footers with the column total. If you only add rows this all works correctly. However as soon as you delete a row, the column footers stop updating because the GetRow() method is returning a null object. Even if you trying adding more rows after you have deleted one, the same error occurs. I have made a sample to illustrate this issue.
Please follow the steps below to reproduce the issue:
1. Add 2 rows to the grid by pressing the add button twice. The column totals should be 2, 2 and 0
2. Delete 1 row. You would expect the column totals to be 1, 1 and 0 but they remain as 2, 2 and 0 because you get the null object javascript error when the totals are recalculated
3. Add another row to the grid and again you get the null object javascript error when the totals are recalculated
Can you please inform on how I can correct this issue?
Hi Mark,
Your issue has been filed as bug #479. The fix will be available in the upcoming hotfix, which is also the last build for WebGrid 7 as R2 is coming soon.
Let me know if you require the build soon, so we can send it separately to your private email.
Thanks!
I checked your sent sample and run it on my end in order to repro the issue. I get javascript error when I click “Add” button. The error is caused from line 101 of DeleteRowBeforeAccepted.aspx file.
QRTPurchaseDelivery.prototype.calculateRowCount = function() { this.txtRowCount.value = this.wgPurchaseDelivery.RootTable.GetRowsCount(); }
GetRowsCount() method is always return null. In batch update scenario, when new row is added (before “Accept Changes”), the amount of rows obtained by GetRowsCount() method will not be updated. For example, if initially the grid has 3 rows. GetRowsCount() will remain returning “3” even if user add another 3 rows of add new row pending changes. Since your grid is initially empty, GetRowsCount() will returns “null” value.
Please let me know if there is anything that I missed during my attempt to repro your issue.
Hi, I think adding the Row Count text field added some confussion to the problem. I have removed this from the sample and re-uploaded it. The issue occurs in the function getTotalTax at the line
var wgRow = this.wgPurchaseDelivery.RootTable.GetRow(i);
after you delete a row that has been added to the grid and for every row you add there after.
Below are the steps to reproduce the issue: 1. Add 2 rows to the grid by pressing the add button twice. The column totals for the last 3 columns shoul be 2, 2 and 02. Delete 1 row. You would expect the column totals to be 1, 1 and 0 but they remain as 2, 2 and 0 because you get the null object javascript error when the totals are recalculated3. Add another row to the grid and again you get the null object javascript error when the totals are recalculatedI am using WebGrid 7.0.7200.304Can you please inform on how I can correct this issue?
1. Add 2 rows to the grid by pressing the add button twice. The column totals for the last 3 columns shoul be 2, 2 and 0
I am using WebGrid 7.0.7200.304
I was unable to download “DeleteRowBeforeAccepted.zip” attachment file. It is said that the file not found.Could you please kindly re-upload the sample file?
Thank you.
Sample uploaded again.
Hi, my application is currently in the Alpha testing phase and is required to go to Beta testing in 15 business days. Can I please get an update on the status of this issue?
Thanks. Can you please give me an estimated date on when the upcoming hotfix will be released?
I sent a message to your registered email address that contains the information about the hotfix file.Please check your inbox and let us know whether the issue still persisted or not.
Hi Yudi, I did not receive any email regarding a hotfix. I can wait for the hotfix to be officially released as long as this is going to happen before the end of the year.
I sent you an email on November 16, 2009 to your email address that registered on this community. I have sent you another message from my gmail personal email account.
Could you please check the “Junk e-Mail” or “Bulk” section?
Sorry Yudi I do not have any emails in my junk folder. Maybe it is being blocked by my IT Department. Can you please try sending it from an intersoftpt.com account with the subject Intersoft WebGrid Hot Fix?
Just did it.J
Hi I have recently downloaded the 2009 R2 SP1 install and applied all hotfixes available as it was my understanding that this issue would be resolved in this version. However I have tested this and I am still getting a null object error.
I have attached an example to replicate the issue. To replicate please do the following:
1. Click the add button and from the Web Dialog Box, select an item and click OK. This will add a row to the grid.
2. Repeat step 1 to add a second item to the grid.
3. Delete the 1st row
4. Repeat step 1. Upon clicking the OK button you will receive the null object javascript error.
If I have implemented something incorrectly please modify the sample to indicate how to resolve this issue.
I have checked and investigated your sent sample.
The sent sample shows that when user click the “btnDeleteItem”, PerformDeleteI() function will be invoked. PerformDeleteI() function execute deleteRow(grid) function, that will undo changes on the selected object that has “Added” row state or just delete selected object.
After the row is deleted, WebGrid will automatically re-index row position and focus to row that has same row position. For example, suppose there are three rows: row-0; row-1; and row-2 (where row-0 is the top row; and row-1 is below row-0; and so on).
If the remaining row after delete operation is 0, grid.GetSelectedObject() will return null (javascript exception appear). Commenting line #246 - #261 in your sent sample (as seen in the snippet code below) will make the page run without any javascript exception.
function performDeleteI() { var grid = ISGetObject("wgIngredients"); deleteRow(grid); var delIndex; //after delete need to re-arrange the records based on Position //get the selected (deleted) row //var wgRow = grid.GetSelectedObject().GetRowObject(); //delIndex = wgRow.Position; //loop through the recordes below the deleted record //and update the Position field //for(var i = delIndex+1; i < grid.RootTable.GetRowsCount(); i++) //{ // var wgRow = grid.RootTable.GetRow(i); // cells = wgRow.GetCells(); // var newValue = cells.GetNamedItem("Position").Value - 1; // cells.GetNamedItem("Position").SetText(newValue.toString(), true); // cells.GetNamedItem("Position").SetDataChanged(); // cells.GetNamedItem("Position").SetChanged(); // wgRow.Update(); //} }
Look forward for your response.
Thank you for the response. I have commented the code out as you suggested but I am still receiving the error. Upon further investigation I have found that the null row object is a result of the GetRowsCount() method still returning a value which includes the deleted rows and using this value to access a row based on its index position results in a null object. The table below shows what I am finding when debugging:
Action Actual Row Count Expected Row Count
Add Row 1 1
Add Row 2 2
Delete Row 2 1
Add Row 3 2
I have modified my sample to include a text box which displays the row count. You will notice that when you delete a row the row count does not decrement. I have left the code you suggested to comment out, uncommented because we need the functionality to be able to display to the user the position of the row in the grid.
In summation the problem is being caused by the fact that the GetRowsCount() method is including deleted rows.
Sorry, however there are some corrupt data while I try to extract the file of yours. Could you re-send me again and make sure that it is download-able, I would really appreciate that.
Best Regards,
Andi Santoso
Sorry about that. I have re-uploaded my sample.
We still unable to extract your sent sample file.I have sent you a message to your registered email account please check your inbox and let us know your response.
Hi, just wondering if you have been able to make any progress on this issue yet?
I have received and made a test on your sent sample on my end. The original version of the sample file does show the issue when delete row a single row remain in WebGrid, but I was not able to repro the issue – row count does not decrement when user delete row. The text box that is used to indicates the value returned by “GetRowsCount()” method is decrementing when user delete row.
So, in my end, the issue that happens is the javascript exception that appears when user deletes the row, a single row that remains in WebGrid. In order to avoid this issue, I simply comment the script that is used to re-arrange the records based on Position after delete in performDeleteI() function.
I enclosed the full project – file system website – of my tester project to be tested on your end. I will also enclosed the video that shows how the page being tested on my end if needed.
Hi
I have tested your sample and the row count now appears to be working correctly after deleting a row. However the row count is still incorrect when you add a row after deleting a row. I have attached a video outlining the steps to reproduce the issue using the last sample you supplied to me.
I was able to repro the “incorrect return value of GetRowsCount() when user add a row after deleting a row” issue on my end. Thank you very much for the sent video.
I’ve forwarded this minor glitch to WebGrid development team to be fixed. A work item, work item #700, has been submitted regarding this. I’ll keep you updated with any news I heard from the team regarding the work item #700.
I’d like inform you about the status of work item #700.
WebGrid development team has managed to get the issue resolved in WebGrid 7. I have tested the nightly build of the hotfix and found that the issue no longer persists.
Should you need to have the nightly build hotfix to be tested on your local end, please let us know.
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