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

Problems when edit Grid rows.

I have app which makes request and get dynamically the columns and after that makes another request for the data.
The Grid is with infinity scroll (when scroll, it loads another data). For the example  pageSize is 10.
If I try to edit each row between 1-10 it works fine, but when I scroll and the grid loads another 10, when I try to edit each of 11 <= row.count I see this error in the console:

ej.web.all.min.js:10 Uncaught TypeError: Cannot read property 'id' of undefined
    at Object.endEdit (ej.web.all.min.js:10)
    at Object._toolbarOperation (....

This is my action for get columns:

public IActionResult GetColumns()
        {
            var data = new[]
               {
                    new { headerText = "ID", field = "id"},
                    new { headerText = "Data", field = "data"},
                    new { headerText = "Value", field = "value"}
                };

            return Json(new { columns = data });

        }
This is the action for get data:

           int count = data.Count();
            var result = data.Skip(dm.Skip).Take(dm.Take);
            return Json(new { result = result, count = count});

This is what returns GetData action (for the example):

{id=21, value = "21", data = "US" },

Getting data works fine.

This is JS:

    var getColumns = ej.DataManager({
        url: "/Home/GetColumns",
        adaptor: new ej.UrlAdaptor()
    });

    var promise = getColumns.executeQuery(new ej.Query()).done(function (data) {


        var dataManager = ej.DataManager({
            url: "/Home/get",
            insertUrl: '/Home/create',
            updateUrl: '/Home/update',
            removeUrl: '/Home/delete',

            adaptor: new ej.UrlAdaptor()
        });
        fields = data.result.columns;
        fields[0].isPrimaryKey = true; // Set id column as primary
        $("#Grid").ejGrid({
            dataSource: dataManager,
            allowScrolling: true,
            allowResizeToFit: true,
            allowReordering: true,
            allowSorting: true,
            allowResizing: true,
            scrollSettings: { height: 200, allowVirtualScrolling: true, virtualScrollMode: "continuous" },
            pageSettings: { pageSize: 10, enableQueryString: true },
            toolbarSettings: { showToolbar: true, toolbarItems: ["add", "edit", "delete", "update", "cancel", "search"] },
            editSettings: { showDeleteConfirmDialog: true, allowEditing: true, allowAdding: true, allowDeleting: true },
            columns: fields
        });
    })
The App loads data fine, but when I try to edit row greather than pageSize (new data loaded), it returns the error.





1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team September 20, 2017 12:42 PM UTC

Hi Customer, 

We are able to reproduce the reported issue and we considered this requirement “Virtual scrolling editing is not working properly and script error thrown” as breaking issue and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.  
  

 
Regards, 
Venkatesh Ayothiraman 


Loader.
Live Chat Icon For mobile
Up arrow icon