tsuoanttila / gridextensionpack Goto Github PK
View Code? Open in Web Editor NEWVaadin Grid Extension Pack
License: Apache License 2.0
Vaadin Grid Extension Pack
License: Apache License 2.0
If I set the page length via PagingControls after a Grid is displayed, the Grid is not refreshed and still displays the old PageLength number of rows.
Here is the basic procedure:
Grid grid = new Grid();
PagedContainer paged = new PagedContainer();
grid.setContainerDataSource(paged);
someLayout.addComponent(grid);
paged.getPagingControls().setPageLength(30);
I don't see any Grid or PagedContainer methods that I might call to trigger Grid refreshing its view. Ideally the Grid refresh should trigger automatically by the PagingControls.setPageLength() but a reasonable workaround might be some way for me to manually trigger the grid refresh.
When you place a Grid in a tab, the moment when you switch away from the tab with the grid to another tab, and error occurs, the Loadindicator at the top right keeps turning, and when you switch back to the tab with grid, the tab is empty. The Following Errors are reported in the WebConsole :
11:36:45.638 Wed Dec 16 11:36:45 GMT+100 2015 com.vaadin.client.VConsole
SEVERE: Widget is still attached to the DOM after the connector (HorizontalLayoutConnector (8)) has been unregistered. Widget was removed.1 experiments:1:7394
this one is shown several times for different connectors. finally :
11:36:45.651 Wed Dec 16 11:36:45 GMT+100 2015 com.vaadin.client.ApplicationConfiguration
SEVERE: (TypeError) : a is nullcom.google.gwt.core.client.JavaScriptException: (TypeError) : a is null
at Unknown.NSb(http://localhost:8080/experiments/)
[...]
On Serverside i could not see any exceptions.
I could reproduce this behavior in the simplest setup possible, HorizontalLayout, tabsheet, 2 tabs, one with just a label, the other with a grid with sidebar.
Thanks for looking into this,
regards
Phineas.
First off - great extension! This is just what I need!
When I enable paging mode and set the page length to something like "10" Grid displays the header row + 9 rows of data from the container. The 10th row is on the page but you must scroll down to see it.
The behavior I expect is that each page will display PageLength data rows without the scrollbar. Perhaps GridExtensionpack is counting the header row when determining the rows to display?
when i select a single row, or deselect last selected row
client invokes deselectAll()
server side deselectAll() want to be sure user can deselectAll all rows and throws Exception if user should not be able to deselect all rows.
in MultiSelectionModelImpl vaadin has
/** * Triggered when the user unchecks the select all checkbox. * * @param userOriginated * {@code true} if originated from client side by user */ protected void onDeselectAll(boolean userOriginated) { if (userOriginated) { verifyUserCanSelectAll(); // all selected state has been update in client side already getState(false).allSelected = false; getUI().getConnectorTracker().getDiffState(this).put("allSelected", false); } else { getState().allSelected = false; } updateSelection(Collections.emptySet(), new LinkedHashSet<>(selection), userOriginated); } private void verifyUserCanSelectAll() { if (!getState(false).selectAllCheckBoxVisible) { throw new IllegalStateException( "Cannot select all from client since select all checkbox should not be visible"); } }
The exception thrown is similar to
2019-06-06 11:13:16.419 ERROR 54655 --- [tp832434213-814] it.imc.vaadin7.CustomErrorHandler : java.lang.IllegalStateException: Cannot select all from client since select all checkbox should not be visible at com.vaadin.ui.components.grid.MultiSelectionModelImpl.verifyUserCanSelectAll(MultiSelectionModelImpl.java:392) at com.vaadin.ui.components.grid.MultiSelectionModelImpl.onDeselectAll(MultiSelectionModelImpl.java:377) at com.vaadin.ui.components.grid.MultiSelectionModelImpl$GridMultiSelectServerRpcImpl.deselectAll(MultiSelectionModelImpl.java:79) at sun.reflect.GeneratedMethodAccessor2667.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.__invoke(DelegatingMethodAccessorImpl.java:43) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:45009) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:45012) at java.lang.reflect.Method.invoke(Method.java:498) at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155) at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:116) at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:445) at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:410) at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274) at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:90) at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1601) at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:445) at it.imc.web.vaadin7.VaadinApplicationServlet.service(VaadinApplicationServlet.java:161) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772) at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:205) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at it.imc.base.web.HeaderAuthenticationFilter.doFilter(HeaderAuthenticationFilter.java:77) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at it.imc.bom.configurations.SetRootFilter.doFilter(SetRootFilter.java:125) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at it.imc.bom.configurations.SetRootFilter.doFilter(SetRootFilter.java:125) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at it.imc.base.web.HeaderAuthenticationFilter.doFilter(HeaderAuthenticationFilter.java:77) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) at org.eclipse.jetty.server.handler.ContextHandler.__doHandle(ContextHandler.java:1180) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:42020) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:426) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335) at it.imc.base.configurations.AddHandlersToJetty$2$1.handle(AddHandlersToJetty.java:143) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.server.Server.handle(Server.java:534) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) at java.lang.Thread.run(Thread.java:748)
// common grid with public setSelectionModel method
CustomGrid g = new CustomGrid();
g.setItems("text1", "text2");
g.addColumn(c -> c).setSortable(true);
TableSelectionModel<String> model = new TableSelectionModel<>();
model.setMode(TableSelectionState.TableSelectionMode.SHIFT);
model.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.HIDDEN);
g.setSelectionModel(model);
Crashes when selecting an item, because MultiSelectionModelImpl#verifyUserCanSelectAll throws an IllegalStateException on selectAll/deselectAll from client.
Using SelectAllCheckBoxVisibility.VISIBLE does not work properly with Vaadin 8.5.1, because TableSelectionModelConnector#initSelectionModel creates a common MultiSelectionModel and overwrites it with a CustomSelectionModel.
The problem is, that com.vaadin.client.widgets.Grid#setSelectColumnRenderer initially creates a HeaderClickHandler.
If you click on the first column for sorting, all items are selected.
Fix is quite simple:
do not overwrite initSelectionModel() in TableSelectionModelConnector. Overwrite createSelectionModel()
Hi,
Just curious how difficult it would be to have the same multiselect support for the Vaadin 8 Tree, i.e. with CTRL click multiselect?
SidebarMenuExtension does not seem to have a simple way to close the sidebar after the custom command has been executed.
While the ability to set it from APIs would be welcome (but it's more work), a much simpler change in the code would already go a long way in helping to customize the extension to obtain that behavior: the relevant method SidebarMenuExtensionConnector.createMenuItem() could be made protected instead of private, allowing override in a custom connector that extends SidebarMenuExtensionConnector.
Right now one must practically write a new connector and tie it with a separate extension (!) - Vaadin won't allow multiple @connect to the same connector unless they're subclasses... plus you cannot inherit directly from SidebarMenuExtension (private constructor, static factory method!) and that means that one has to import into every project and mantain two different full source files from GridExtensionPack just because of a private method.
It would be great if you could change that single line of code (and perhaps review the addon someday and do the same with a bunch of other private-for-no-reason methods all over the code... they make using the addon needlessly harder)
protected void ctrlClickSelect(SelectionModel<JsonObject> model, CellReference<JsonObject> cell,
GridClickEvent event) {
NativeEvent e = event.getNativeEvent();
JsonObject row = cell.getRow();
if (!e.getCtrlKey() && !e.getMetaKey()) {
model.deselectAll();
}
if (model.isSelected(row)) { // can never be true, if all items were deselected in former if condition
model.deselect(row);
} else {
model.select(row);
}
}
I've been trying to use wscdn to compile this on 7.6.8 and 7.7.0beta1. It seems to get a 500 error every time.
Is this add on broken on those versions?
Thanks.
I am using a SelectGrid
with a TableSelectionModel
using the selection mode TableSelectionMode.SHIFT
.
When selecting a previously unselected row without holding the Ctrl key, the underlying CtrlClickSelectionHandler
calls SelectionModel<JsonObject>.deselectAll()
. This triggers an event with an empty selection, almost immediately following by an event with the newly selected row.
Example:
SelectGrid<T> grid2 = new SelectGrid<>();
TableSelectionModel<T> tableSelectionModel = new TableSelectionModel<>();
tableSelectionModel.setMode(TableSelectionMode.SHIFT);
grid2.setSelectionModel(tableSelectionModel);
grid2.addSelectionListener(event -> {
LOGGER.debug(String.format("%d entries in selection",
event.getAllSelectedItems().size()));
});
When selecting a row as described above, the logger returns the following:
[DEBUG] 0 entries in selection
[DEBUG] 1 entries in selection
I would have expected only one event containing the new selection instead of two, one of which contains an empty selection. Is it possible to allow for this behaviour?
The following causes PagingControls#updatePageNumber() to be called in a state which results in the page number being -1.
backendProvider.refreshAll();
pagingProvider.getBackendSize();
I will submit a pull request in a bit. I want a issue number to mention in the commit first.
I use the extension pack for SHIFT selection.
It works great - until the table gets a little bigger.
For example with 200 lines it doesn't work anymore. After selecting the 1st line, scroll down and select the 190th line (with SHIFT+Click) there are much less than 190 selected - the upper ones are simply missing. (the number of rows varies a bit - I guess because of the table width)
Is there a solution here?
Problem: with the extensions the checkboxes is not visible. So we can't select all
My code: (mGrid = Vaadin 8.4.0 Grid)
public B withMultiSelect() {
TableSelectionModel<T> multiSelect = new TableSelectionModel<>();
multiSelect.setMode(TableSelectionState.TableSelectionMode.SHIFT);
multiSelect.setUserSelectionAllowed(true);
multiSelect.setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility.VISIBLE);
mGrid.setSelectionModel(multiSelect);
mIsMultiGrid = true;
return (B) this;
}
Clicking in that area should just be ignored.
Trace:
Caused by: java.lang.NullPointerException at org.vaadin.teemusa.gridextensions.contextclick.ContextClickEvent.<init>(ContextClickEvent.java:18) at org.vaadin.teemusa.gridextensions.contextclick.ContextClickExtension$1.contextClick(ContextClickExtension.java:28) ... 33 more
Please upgrade you great extension to Vaadin 8.
When I use PagedContainer with Grid the bottom portion of the Grid is clipped (not displayed) unless I click and select and item in the table.
This screenshot shows the problem. This is what I see when the page loads before I click on anything:
After clicking any item in the grid I see the grid properly displayed:
If I disable PagedContainer in the same Grid, it works fine. Here is what it looks like:
Here is a summary of my code:
Grid grid = new Grid();
PagedContainer pagedContainer = null;
pagedContainer = new PagedContainer(getJpaContainer());
pagedContainer.setGrid(grid);
grid.setContainerDataSource(pagedContainer);
The Grid resides inside of a fairly complex layout hierarchy which I cannot easily provide code for.
I'm using Vaadin 7.5.1 and GridExtensionPack 0.2.2
Vaadin debug mode -> Analyze Layout shows no problems.
Thanks for the nice code! We used Tables extensively in the past and really miss them in Vaadin 8.
Could you add all the Table constructors to the SelectGrid
class? Would like to do the equivalent of Grid<Query> grid = new Grid<>(Query.class);
to have the Grid configure columns.
Thanks!
-dan
It would be nice to have the option to select rows using the SHIT key.
In the Developer Guide and Features, was used a references to a ContextMenuExtension class, that is not included on the add-on. Is this a redaction mistake? or the class is missing on the add-on?.
When i click in the empty area at the bottom of a Grid, the context menu is not shown.
I need a context menu with the entry "new" there, if there is no data in the Grid or the user clicks on the area below the last data row if the data does not fill the whole table area.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.