Closed aherrick closed 4 years ago
Hello @aherrick
waht you want to accomplish by this scenario? If you want to filter by this value you can use filter API which FlexGrid provide.
Hi @Mewriick I don't want/need to use the built in table filtering. For example I may have a field that isn't showing or used in the grid that I simply want to filter by.
I'm just simply trying to force a callback.
Ok, unfortunately now there is not such a feature to force call API when you click your button.
Only solution now maybe is
private void ApplyFilters()
{
lazyLoadingOptions = lazyLoadingOptions.RequestParams.Add("Search", "SearchString");
}
which should invoke OnSetParameterAsync
method in FlexGrid and ther is call to go to first page which invoke API call.
Resetting lazyLoadingOptions in this way isn't valid.
Yeah, I see it now. So basically you can do this:
private void ApplyFilters()
{
lazyLoadingOptions = new LazyLoadingOptions()
{
DataUri = lazyLoadingOptions .DataUri,
PutDataUri = lazyLoadingOptions.PutDataUri,
DeleteUri = lazyLoadingOptions.DeleteUri
}.RequestParams.Add("Search", "SearchString");
}
Hmm so I'm trying even this and still isn't forcing a server call:
private void ApplyFilters()
{
lazyLoadingOptions = new LazyLoadingOptions()
{
DataUri = lazyLoadingOptions.DataUri
};
}
The OnParametersSet and OnParametersSetAsync methods are called when a component is first initialised and each time new or updated parameters are received from the parent in the render tree.
your scenario is that object is still same
I've tried below which doesn't work.
lazyLoadingOptions = new LazyLoadingOptions()
{
DataUri = lazyLoadingOptions.DataUri
};
lazyLoadingOptions.RequestParams.Add("test", "test");
While this throws errors:
lazyLoadingOptions = new LazyLoadingOptions()
{
DataUri = lazyLoadingOptions.DataUri
}.RequestParams.Add("test", "test");
Is there a different way to Initialize the object and set the request parameters at the same time?
I think you can do this
var secondLazyLoadingOptions = ..... ;
lazyLoadingOptions = secondLazyLoadingOptions ;
Unfortunately that doesn't work either:
private void ApplyFilters()
{
var secondLazyLoadingOptions = new LazyLoadingOptions()
{
DataUri = lazyLoadingOptions.DataUri,
};
secondLazyLoadingOptions.RequestParams.Add("test", "test");
lazyLoadingOptions = secondLazyLoadingOptions;
}
Not sure how you fill the RequestParams
in initialization as it's a get
only property.
Ok I think that OnParametersSetAsync
of FlexGrid is called but some conditions are false and method which call API is not called. This is not supported scenarion and this is only hack so this can not be done now
Ok, unfortunately it's a deal breaker for me then to use the Grid.
Yeah Ok, also you can suggest how to solve this and use pull request.
I have code like this. When I click Apply Filters I want the grid to fire back to the API endpoint with the added Request Parm. How do I do this?