Hi,
I have a strange issue, I have a bottom that adds a new records into WebDataGrid using Java script, the issue that after I add the first new row, and trying to add second row it deletes the first row , after that it works fin, only with the first row at the first time! also the counting starts with 0, so when i insert the row, it would give me 0 under No. and then when I add a new row it deletes the 0 row and add the 1 No, and it goes normally, can you please help?
function AddDocCheckList() { var grid = $find('<%= chdocs_web.ClientID %>'); var rowscount = grid.get_rows().get_length() +1 ; var doctype = $find('<%= chdoctype_drop.ClientID %>'); var chyes = $find('<%= chyes_drop.ClientID %>'); var chComments = $find('<%= chcomments_txt.ClientID %>'); var rows = grid.get_rows(); var rr = new Array(rowscount, doctype.get_selectedItem().get_value(), chyes.get_selectedItem().get_value(), chComments.get_value()) grid.get_rows().add(rr); }
<igtxt:WebImageButton ID="checkinsert_btn" runat="server" Text="Insert Document" AutoSubmit="false"> <ClientSideEvents Click="AddDocCheckList" /> <Appearance> <Image Url="./Res/Apps-Dialog-Add-icon.png" /> </Appearance> </igtxt:WebImageButton>
<ig:WebDataGrid ID="chdocs_web" runat="server" AutoGenerateColumns="False" DataSourceID="ComDocchecklistDS" Height="350px" Width="561px" EnableAjax="False"> <Columns> <ig:BoundDataField DataFieldName="orderno" Key="orderno" Width="35px"> <Header Text="No."> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="doctype" Key="doctype"> <Header Text="Document Received"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="yesno" Key="yesno" Width="60px"> <Header Text="Yes/No"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="comments" Key="comments"> <Header Text="Comments"> </Header> </ig:BoundDataField> </Columns> <Behaviors> <ig:EditingCore BatchUpdating="True"> </ig:EditingCore> </Behaviors> </ig:WebDataGrid>
First attempt to insert a row
second attempt and afterwards, you can see it deleted the 0 No which was inserted in the first attempt
Hello,
I have created a small sample trying to reproduce the described behavior. I am using WebDataGrid with version 22.1. On my side everything works as expected and I am able to add rows to the empty grid on the client-side without any issues, the rows are added starting from index 0 and no rows are deleted after their addition. I have tested the sample in Edge and Chrome.
Attached you will find my sample for your reference. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this case.
Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.
Thank you for your cooperation.
Looking forward to hearing from you.
Regards, Ivan Kitanov
AddRowToEmptyGrid.zip
Thanks Iva,
your sample is worked fine for me, but the issue was that when I set a data source to the DataGrid using the smart tag the problem appears, so now after I removed the data source from properties and set it in the code behind like your sample it worked fine, could please try the same JavaScript code while the data source set using the smart tag? I'm ok now with this solution, but still want to know why this happening when I set the data source manually!
Again, I appreciate your kind support.
I have tried to reproduce this behavior using the smart tag to set the data source from the designer, however I wasn’t able to reproduce it.
If you could provide a sample that reproduces the issue, I will be glad to investigate it.