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. Image for the cookie policy date

adding dynamic data into tree grid

Scenario : add new blank row below selected row, then I enter some data into blank row.
Issue : I am getting blank data from above newly added row by using args.model.selectedItem.

sample code :

$("#TreeGridContainer").ejTreeGrid({
        dataSource: productArray,
        childMapping: "children",
        treeColumnIndex: 1,
        isResponsive: true,
        showColumnChooser: true,
        allowSorting: true,
        editSettings: {
            allowAdding: true,
            allowEditing: true,
            allowDeleting: true,
            editMode: "rowEditing",
            rowPosition: "belowSelectedRow"
        },
        columns: [
{ field: "Name", headerText: "Name" },
{ field: "Description", headerText: "Description" }
        ],
        toolbarSettings: {
            showToolbar: true,
            toolbarItems: [
                ej.TreeGrid.ToolbarItems.Add,
                ej.TreeGrid.ToolbarItems.Edit,
                ej.TreeGrid.ToolbarItems.Delete,
                ej.TreeGrid.ToolbarItems.Update,
                ej.TreeGrid.ToolbarItems.Cancel,
                ej.TreeGrid.ToolbarItems.ExpandAll,
                ej.TreeGrid.ToolbarItems.CollapseAll
            ]
        },
        //endEdit: function (args) {
        //    debugger
        //    if (args.columnName == 'Description')
        //        var data = args.data;
        //},
        toolbarClick: function (args) {

            if (args.itemName == 'Update') {

                debugger
                var treegridObj = $("#TreeGridContainer").data("ejTreeGrid");
                treegridObj._saveRow();
                if (args.model.selectedItem.level == 0) {
                    args.model.selectedItem['Id'] = args.model.currentViewData[args.model.currentViewData.length - 1].Id + 1;
                    args.model.selectedItem.children = [];
                }
                
                treegridObj.addRow(args.model.selectedItem, ej.TreeGrid.RowPosition.Child);
            }
        }
    })

Thanks and regards,
Pramod

1 Reply

JS Jonesherine Stephen Syncfusion Team July 27, 2016 03:44 PM UTC

Hi Pramod, 
We regret for the inconvenience caused. 
We have analysed the reported issue with our sample. We are unable to reproduce the issue. Can you please revert us by modifying the sample based on your application along with the replication procedure? This would be helpful for us to serve you. 
Please let us know if you need more information on this.
Regards,
Jone sherine P S
 


Loader.
Live Chat Icon For mobile
Up arrow icon