getSelectedData - not working

0 Answers 61 Views
Grid
AP
Top achievements
Rank 1
Iron
Iron
Veteran
AP asked on 02 Aug 2023, 01:04 PM

I have a grid showing a list if items, with a checkbox to allow multiple rows to be selected. Virtual scrolling has been enabled, as there will be over 1000 items in the list.

I need to identify all selected rows as these will form the basis of a filter to be applied to another grid. I'm trying to use the getSelectedData method, but this keeps throwing the error:-

Uncaught TypeError: Cannot read properties of undefined (reading 'selectedRanges')

The grid definition is:-


@(Html.Kendo().Grid<InformaticsCommissioningHelper.Models.IPWLList>()
        .Name("gridListNames")

            .Columns(columns =>
            {
                columns.Select().Width(50);
                columns.Bound(p => p.ListName).Title("List Name");
            })

 .PersistSelection()
 .Events(e=>e.Change("listGridChange"))
        .DataSource(dataSource => dataSource
        .Ajax()
        .Model(model => model.Id(p => p.ListName))
        .PageSize(25)
        .Sort(s =>
        {

            s.Add(a => a.ListName).Ascending();


        })

        .Read(read => read.Action("GetListNames", "SelectTest"))
        )
        .Sortable()
         .Scrollable(scrollable => scrollable.Virtual(true))

          .HtmlAttributes(new { style = "height: 400px;" })

    )


There's a button that then runs the function:-


 function test()
    {
        var grid = $("#gridListNames").data("kendoGrid");
       

        console.log(grid.getSelectedData());
    }

The project is using version v2023.2.606 .  

I have tried using the change event to identify the selections, but this only works for the active page, which doesn't work for a scrollable grid.

 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
AP
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or