Is it necessary to Invoke twice the same method to reload data after new filters?

Hello, I'm pretty new to radzen and I have a question,

I have on the Load event a invoke that filters data based on a Property given by a Datepicker.
The result from the invoke is displayed in a text field.

Now, on load the data showed is correct, but when I change the date on the DatePicker, the text field won't be reloaded with the new data, as the Invoke didn't rerun as it's on the main Load event.

I already have a solution, but it implies doing the same invoke twice, once initially on the Load event, and then on the onChange event from the Datepicker, using the same names.

This fixes my issue but it doesn't look like a clean solution.

I had the same issue with a Grid and a datepicker, but there you can Invoke in the GridLoad event, and then in the DatePicker change event, call this.grid.load(), which would trigger again the Invoke.

But I cannot use the same solution with the TextBox, as it only has a Change event, and not a onLoad one where I can call the Invoke.

What is the best solution for this? Is there a way to force an Invoke again in a Change Event, without having to call it again?

Maybe this article will help you: https://www.radzen.com/documentation/date-range-filter/

@enchev hey, thank you for the answer, but that doesn't help me, as I said that when we are talking using filters on a Grid, that's easy, because you just call this.grid0.load() after setting the filter variable, and it will rerun the invoke on the grid using the new filter variables for the invoke..

but what if I have a text-box, which has not a this.grid0.load()...how can I reload a text-box value, that comes from an invoke that is called in the main Load event? in your example, when you press Filter , it does this.grid0.load(), so the grid loads again and does a new invoke...how can I do that with a text-box?

If the TextBox Value is bound to a Page property it will be updated immediately after property value change.

@enchev again, thank you for the answer, but it doesn't answer my question sadly :relieved:

what if the Value of the TextBox is : getMyInvokeResult

getMyInvokeResult is the result of a Invoke, that has as Filter a date.

When I change the date from a Datepicker, how can I force to load again the invoke (which is on the main page Load event) so it loads updated data for the new filter,
and finally updated the value of getMyInvokeResult so my Text-Box has the updated value?

Currently the only solution I See for this, if the invoke is on the Page main Load event, is to have a second invoke, of the same type, that saves the result onto the same property ( getMyInvokeResult) running in the Change event of the DatePicker, so each time the date is changed, it will run the second invoke, and update getMyInvokeResult

is this the only solution? I Wanted to avoid calling twice the same invoke

There are no method invokes with $filter parameter that will return single value - only arrays usually used to populate a DataGrid component. If this is the case you can avoid two calls to your invoke method if you invoke it only on DataGrid LoadData and just call grid.load() on Page Load.

@enchev in my case, the invoke returns an array, that array will fill different Text-box components in my Page, and the invoke has a Date Filter thanks to a DatePicker.

So you see my issue, as I'm not using the data for a Grid.

Is there a container that has a load() property? So I can put all my text-boxes inside a container, and when I change Date with the DatePicker, I can call container.load() and have my invoke run again

Yes, you can use DataList and put the TextBox in the DataList Template. The DataList is similar to DataGrid - you have LoadData event and .load() method.

1 Like