JSRuntime.InvokeAsync not working anymore Version 20.2.0.36

Hi,

In my source i use the following for scrolling to a postion in the DataGrid:


var index = await LocalStorageService.GetItemAsync<double>("tripscrollindex");

await JSRuntime.InvokeAsync<object>("scroll", index);


The javascript scroll look like this and comes from your example BlazorApp1Sample1968938411:

function scroll(index) {

    try {

        var grid = document.getElementsByClassName("e-grid")[0].blazor__instance;

        var rowHeight = grid.getRowHeight();

        grid.getContent().scrollTop = (index - 1) * rowHeight;

    }

    catch (err)

    {

        var x = err

    }

}

The error:

Document
NameValueType
xTypeError: Cannot read properties of undefined (reading 'getRowHeight') at scroll (https://localhost:7092/js/sfdatagrid.js:4:30) at https://localhost:7092/_framework/blazor.server.js:1:3501 at new Promise (<anonymous>) at kt.beginInvokeJSFromDotNet (https://localhost:7092/_framework/blazor.server.js:1:3475) at https://localhost:7092/_framework/blazor.server.js:1:72001 at Array.forEach (<anonymous>) at kt._invokeClientMethod (https://localhost:7092/_framework/blazor.server.js:1:71987) at kt._processIncomingData (https://localhost:7092/_framework/blazor.server.js:1:70029) at connection.onreceive (https://localhost:7092/_framework/blazor.server.js:1:64432) at o.onmessage (https://localhost:7092/_framework/blazor.server.js:1:48766) {stack: 'TypeError: Cannot read properties of undefine…ost:7092/_framework/blazor.server.js:1:48766)', message: 'Cannot read properties of undefined (reading 'getRowHeight')'}TypeError


In the scroll function the value of the grid = undefined.


Can you help me out please because i need the function because the DataGrid starts on the first item now.


Best regards,

Thijs van Rijswijk




1 Reply 1 reply marked as answer

NP Naveen Palanivel Syncfusion Team July 5, 2022 05:20 AM UTC

Hi Thijs van Rijswijk,


We have checked your query and we could not able to reproduce the reported issue on using JSRuntime.InvokeAsync
at our latest version (20.2.0.36 ). kindly share the below details to validate further at our end.


  1. Share us the entire grid code snippet along with model class.
  2. Share the screenshot of the issue you are facing.
  3. If possible share us simple issue reproducible sample.


Above request details will be very helpful for us to further validate the reported query at our end and provide solution as easy as possible.


Regards,

Naveen Palanivel


Attachment: SyncfusionBlazorAppGrid1_(2)_9a47ac41.zip

Marked as answer
Loader.
Up arrow icon