We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to maintain the rows inserted by javascript in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

117241 Sep 13,2014 05:47 PM UTC Sep 18,2014 01:40 PM UTC ASP.NET Web Forms 6
loading
Tags: Grid
Roimer Machacón Otero
Asked On September 13, 2014 05:47 PM UTC

Hi, We're using Grid control for save and show information to the users, Now by Javascript in the event onclick of a linkbutton asp.net want save rows in the grid. 

Our method it's work but in the grid only save one row, is that if the grid no maintain the rows saved previously. 

Also when is save a row the grid show the row and inmediately this disappears, not is maintains visible for the user.

Mohammed Farook J [Syncfusion]
Replied On September 15, 2014 11:56 AM UTC

Hi Nestor,

 

Thanks for using Syncfusion products,

 

We are glad to let you know that we have achieved your requirement by using “Batch Editing” in Grid. This property will maintained the user changes until the Save Operation. please find the code snippet.

 

       <ej:Grid ID="EmployeesGrid" runat="server" DataSourceID="ObjectData" AllowPaging="true" AllowResizeToFit="true" Width="1500px" >

       <EditSettings AllowAdding="True" AllowEditing="True" AllowDeleting="True"  EditMode="Batch" ></EditSettings>

        <ToolbarSettings ShowToolbar="true" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>

          <Columns>

              <ej:Column Field="EmployeeID" HeaderText="Employee ID" Width="80" />

              <ej:Column Field="FirstName" HeaderText=" First Name"  Width="100" />

              <ej:Column Field="LastName" HeaderText="LastName" Width="80" />                       

               </Columns>

 

                    </ej:Grid>

 

 

For your convenience we have attached a Sample and the same can be downloaded from below link:

 

Sample Location: Sample.zip

 

Regards,

J.Mohammed Farook


Roimer Machacón Otero
Replied On September 16, 2014 02:11 PM UTC

Hi, attached a small video where it can be seen what happens.

Attachment: Forum_9110bff2.rar

Mohammed Farook J [Syncfusion]
Replied On September 17, 2014 12:11 PM UTC

Hi Nestor,

 

Sorry for the inconvenience caused.

 

We have analyzed your video and we are unable to get your query . could you please elaborate your query? This will be helpful to sort out issue.

 

Please let us know if you have any queries,

Regards,

J.Mohammed Farook


Roimer Machacón Otero
Replied On September 17, 2014 01:59 PM UTC

Hi, attached the example of the project. This hasn't queries.

Roimer Machacón Otero
Replied On September 17, 2014 02:01 PM UTC

Hi, attached the example of the project. This hasn't queries.

Attachment: Example_79be0ca2.rar

Mohammed Farook J [Syncfusion]
Replied On September 18, 2014 01:40 PM UTC

Hi Nestor,

 

We have analyzed your project and We have created a sample”ejGrid with dynamic columns added”. Please find the code snippet.

 

<script type="text/javascript">

        function alerta() {

            var obj = $("#gvsDetalle").data("ejGrid");

           

            var numeroDetalle = document.getElementById('<%= txtPrueba.ClientID%>').value;

            var codigoActividad = document.getElementById('<%= txtPrueba.ClientID%>').value;

            window.gridData = [

              {

                  NumeroDetalle_DetPlan: numeroDetalle, Lote_DetPlan: codigoActividad

              }

            ];

 

            //var dataManager = ej.DataManager(window.gridData);

            //dataManager.insert({ NumeroDetalle_DetPlan: "Joel", Lote_DetPlan: "Beckett" });

            if ($("#gvsDetalle").data("ejGrid") !== undefined) {

                obj.addRecord({

                    NumeroDetalle_DetPlan: numeroDetalle, Lote_DetPlan: codigoActividad

                });

            }

            else

            $("#gvsDetalle").ejGrid({

                dataSource: window.gridData,

            });

        }

        </script>

 

In above same we have created a object for the Grid.

 

var obj = $("#gvsDetalle").data("ejGrid");

 

We have using the public method “addRecord” for dynamic column added in Grid.

 

            if ($("#gvsDetalle").data("ejGrid") !== undefined) {

                obj.addRecord({

                    NumeroDetalle_DetPlan: numeroDetalle, Lote_DetPlan: codigoActividad

                });

            }

 

 

For your convenience we have attached a sample and the same can be download from the link:

 

Sample:

 

http://www.syncfusion.com/downloads/support/directtrac/129241/WebSite225237067.zip

 

Please Let us know if you have any queries,

Regards,

J.Mohammed Farook


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;