Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
Add new row into WebDataGrid using Javascript deleteing the first row
posted

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>

<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>

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

Parents Reply Children
No Data