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

Client side data referesh

I am working with the ej2 grid and I cannot find an article on how to rebind the datasource on the client side using a button click or some type of cascading event like a combo change.


<ejs-grid id="contactsGrid" width="100%" allowPaging="true"

          query="new ej.data.Query().addParams('filter', GetFilter()).addParams('activeOnly', GetActive()).addParams('inmatePayTelUserId', GetInmatePayTelUserId()).addParams('customerPayTelUserId', GetCustomerPayTelUserId())">

    <e-data-manager adaptor="UrlAdaptor" url="/VisitHistoricals?Handler=UrlDataSource"></e-data-manager>

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

    <e-grid-columns>

        <e-grid-column allowEditing=false field="reservationId" headerText=" " visible=false isPrimaryKey=true></e-grid-column>

        <e-grid-column allowEditing=false field="startDateTimeUtc" headerText="Date" visible=true></e-grid-column>

        <e-grid-column allowEditing=false field="inmateName" headerText="Inmate" visible=true></e-grid-column>

        <e-grid-column allowEditing=false field="customerName" headerText="Customer" visible=true></e-grid-column>


    </e-grid-columns>

</ejs-grid>


I have the above grid with url datamanager and additional query parameters.  I would like to be able to click a button after changing some of the query parameters and force the grid to perform an ajax call to using it's datamanager and query parameters to return data just like it would on page load.  Then I can assign the new data to datasource.


1 Reply 1 reply marked as answer

SI Santhosh Iruthayaraj Syncfusion Team April 12, 2023 01:57 PM UTC

Hi Brandon,


Greetings from Syncfusion support.


To address your concern, we recommend using the "freezeRefresh" method of the Grid to reload the Grid and the dataSource. This should help you load the updated data after changing the query parameters on button click.


Please let us know if you have any further questions or concerns.


Regards,

Santhosh I


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon