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

DataGrid with Page Size Dropdown - handle event "dropDownChanged" with adaptor="urlAdaptor"

In a Datagrid I need a method is recalled every time the user changes the number of elements in the page for the grid using the Pager combox.
I've seen in the documentation that this control should trigger a dropDownChanged  event.
But I'm not able to figure out how to connect to this event in net core and how I refresh the grid after that new selection...
Can you help me ? Please make a simple example.

Best regards

My grid:

 <ejs-grid id="GridObra" dataBound="dataBound" rowSelected="LinhaObraSel"

              query="new ej.data.Query().addParams('idFiltroTexto', '@Model.FiltroTexto')

                                        .addParams('idFiltroActivo', '@Model.FiltroActivo')

                                        .addParams('idFiltroOrdenacao', '@Model.IdxLstOrdenacao')"

              allowSorting="false" allowPaging="true" enablePersistence="false" gridLines="Both" recordDoubleClick="onRecordInstDoubleClick" locale="pt">

        <e-grid-filtersettings type="Menu"></e-grid-filtersettings>

        <e-grid-resizesettings mode="Auto"></e-grid-resizesettings>

        <e-grid-pagesettings pageSize="3" pageSizes="@(new string[] {"3","5","10"})"></e-grid-pagesettings>

        <e-grid-selectionsettings enableToggle="false"></e-grid-selectionsettings>

        <e-data-manager url="/Obras/RetornaDadosGrid" adaptor="UrlAdaptor" crossdomain="true"></e-data-manager>

        <e-grid-columns>

            <e-grid-column field="Estado" headerText="Estado" width="120" allowFiltering="false" textAlign="Left" allowSorting="true"></e-grid-column>

            <e-grid-column field="NomeObra" headerText="Nome" width="120" allowFiltering="false" textAlign="Left" allowSorting="true"></e-grid-column>

         </e-grid-columns>

    </ejs-grid>


4 Replies 1 reply marked as answer

RS Rajapandiyan Settu Syncfusion Team March 9, 2023 01:10 PM UTC

Hi Pedro,


Thanks for contacting Syncfusion support.


When we change the page size from the dropdown, the Grid will get refreshed automatically and send the request to the server. Please find the attached sample for reference.


Why do you want to bind the dropdownChanged event and what actions do you want to perform when changing the page size value from dropdown?


Regards,

Rajapandiyan S


Attachment: core_grid_pagesize_change_c00342ac.zip

Marked as answer

PA pedro alegria March 9, 2023 02:09 PM UTC

Hi, thanks! Your example work correctly, 

I think it's a problem in my code, I will check!


Best regards


Pedro A


    



PA pedro alegria March 9, 2023 03:04 PM UTC

Hello, 

   

   I'm not testing dm.skip or dm.Take != 0 and that is my code problem, because when the number of records is equal to total page  records selected dm.take is 0...

Thanks for your help and sample!


Now is working.


Best regards 


Pedro A


  



RS Rajapandiyan Settu Syncfusion Team March 10, 2023 11:41 AM UTC

Pedro,


We are happy to hear that you have achieved your requirement with the sample provided.


Please get back to us if you need further assistance.


Regards,

Rajapandiyan S


Loader.
Live Chat Icon For mobile
Up arrow icon