Hi Team,
I am currently looking for pagination implementation on the Vaadin Grid,not able to see any stuff regarding the same.
So currently i am doing it manually, and i am facing issue :- The value is not rendering which having Date type field when i am removing whole children data from grid component and adding again new data.
i am using LocalDateTimeRenderer < > for given input.
It’s a lot of code and I can’t see what causes the issue from your description.
Could you please localize the problem? If I understood your correctly a Date type column
is the source of the issue. So may be it’s enough to have only this column and
almost everything else is just not relevant?
whole children data from grid component and adding again new data
What do you mean by children data? The data which you use to set into the Grid?
Or you are using some components inside the Grid?
It’s working and populate date properly, But when removing content from grid using (configGrid.getElement().removeAllChildren()) and then again rendering date with same below code then it’s not rendering date while date is available in grid.
I’m not sure that this is a correct way to do.
Technically, you are breaking the client side element when you do configGrid.getElement().removeAllChildren().
The content of Grid is not populated from the server side but there are client side elements in the web-component. And removeAllChildren() is implemented nowadays (I hope I’m not wrong) so that it removes all children including client-side children.
This may break the functionality of a grid web component.
Why you don’t just replace the data (via data providers or setItems)?
I have one more question.
I need to implement loader and for this using client side script for remove loader view but giving error of reference error (_removeLoader) is not defined. Below code is client side template with function and server side java code for calling the client side function:-
If you are developing a server-based application, I don’t think you need to tinker with any client-side code when using Grid component. Grid has got all the rich features to control everything from the server side itself. If you post your requirements here (with a simple example), someone will offer help.
UI.getCurrent().getPage().executeJavaScript("_removeLoader()");
This executes a global function _removeLoader() somehow defined.
If you want to execute a function for some element then you may do either Element.callFunction or UI.getCurrent().getPage().executeJavaScript("$0._removeLoader(), element)";.
Calling like this ‘loaderIndicatorId.callFunction(“_removeLoader”)’ give TypeError: _removeLoader loader is not a function.
public void afterNavigation(AfterNavigationEvent event) {
loaderIndicatorId.callFunction(“_removeLoader”);
}
But your function is defined for main-view web component.
There is no function _removeLoader in your loading indicator element which is div.
You should call function for the main view instance instead.
As this is main view(Parent) for all view then would you let me know how to instantiate it.
And also can suggest any stuff for access element of parent view from child view and vice versa.
It’s instantiated for you. If you instantiate it explicitly then it won’t be used by router since it doesn’t know about it.
If your method public void afterNavigation(AfterNavigationEvent event) is inside MainView class then just implement it as getElement().callFunction("_removeLoader") and that’s it.
Thanks for your quick response.
Please, Also suggest for access children of parent view from child view and vice versa from server side java code and client side script.
I tried below but return empty list but this class element is available in parent.
List components = getElement().getParent().getChildren()
.filter(element → element.getClassList().contains(“v-loading-indicator”))
.collect(Collectors.toList());
Please, Share if any stuff is available for the same.
Thanks.