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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Gridtree: Adding rows

Thread ID:

Created:

Updated:

Platform:

Replies:

121139 Nov 13,2015 12:05 PM UTC Nov 20,2015 08:39 AM UTC ASP.NET Web Forms 7
loading
Tags: TreeGrid
Jorge Pampin
Asked On November 13, 2015 12:05 PM UTC

Hello,

How to add a row as child of the selected row by javascript?

I use this code:

 var Record ={ IdRow: createGuid(), Nombre: 'Nueva', ID: '', IdParent: treegObj.selectedItem().IdRow };
  treegObj.addRow(Record, ej.TreeGrid.RowPosition.Below);

Thanks!

Dinesh Kumar Nagarathinam [Syncfusion]
Replied On November 16, 2015 02:55 PM UTC

Hi Jorge,

We can add a new row as child, by setting “RowPosition” enumeration value as “Child”.

Code Snippet:


<script type="text/javascript">  

            function addNewRow() {

                var treeObject = $("#Treegrid").data("ejTreeGrid");

                var newRecord = { Id: 10, Name: "childTask", StartDate: "02/23/2014", EndDate: "02/27/2014" }

                treeObject.addRow(newRecord, ej.TreeGrid.RowPosition.Child);               

            }
        </script>


We have prepared a sample based on your requirement, find the sample from below location.

Sample: http://www.syncfusion.com/downloads/support/forum/121139/ze/Add_child_Row407766024

Please let us know, If you need further assistance on this.

Regards,

Dinesh kumar.N


Jorge Pampin
Replied On November 17, 2015 09:13 AM UTC

Hello,

It works perfectly. But, the primary key column (IdRow) is a Guid datatype, and when I create a new row the GridTree changes the value of the IdRow column from Guid to integer, why?

Thanks!

Dinesh Kumar Nagarathinam [Syncfusion]
Replied On November 18, 2015 12:50 PM UTC

Hi Jorge,

If data type of the primary key column (IdRow) is GUID, then the id of newly added record has also to be a GUID data type. We have prepared a sample based on your requirement, Find the sample from below location.

Sample: http://www.syncfusion.com/downloads/support/forum/121139/ze/TreeGridSample_with_GUID-1479806403

Please let us know, if you need further assistance on this.

Regards,

Dinesh kumar.N


Jorge Pampin
Replied On November 18, 2015 02:24 PM UTC

Hello,

You can reproduce it if you changes ChildMapping="Children" for IdMapping="Id" ParentIdMapping="IdParent". IdParent is a new field of BusinessObject class. I need to use IdMapping and ParentIdMapping properties.

Thanks!



Dinesh Kumar Nagarathinam [Syncfusion]
Replied On November 19, 2015 04:52 PM UTC

Hi Jorge,

Do you want to generate GUID for IDRow automatically when we add a new row using toolbar?. For clarification, please find the below screenshot,

Screenshot: http://www.syncfusion.com/downloads/support/forum/121139/ze/Screenshot-438427437

Please let us know, if you need further assistance on this.

Regards,

Dinesh kumar.N


Jorge Pampin
Replied On November 19, 2015 05:30 PM UTC

Hello,

My problem is that the treegrid changes the value of the GUID to an integer value. I create the new rows by javascript:

  var Record = { IdCuenta: createGuid(), Nombre: TextoNuevaCarpeta, ID: '', IdPadre: treegObj.selectedItem().IdCuenta };
  treegObj.addRow(Record, ej.TreeGrid.RowPosition.Child);

IdCuenta has an GUID value, but when it is shown on the treegrid, the value changes to autogenerated integer value.

Thanks!

Dinesh Kumar Nagarathinam [Syncfusion]
Replied On November 20, 2015 08:39 AM UTC

Hi Jorge,

We regret for the inconvenience caused.

We were able to reproduce the issue while adding new row using public method with GUID data type and we have confirmed this as bug and logged a report on this. Also we have created a support incident under your

account to track the status of this issue.

Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let us know if you require further assistance on this.

Regards,

Dinesh kumar.N


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

;