Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inmethod grid "deselect all" doesn't work #64

Closed
martin-g opened this issue Oct 4, 2011 · 7 comments
Closed

Inmethod grid "deselect all" doesn't work #64

martin-g opened this issue Oct 4, 2011 · 7 comments
Labels

Comments

@martin-g
Copy link
Member

martin-g commented Oct 4, 2011

Open http://www.wicketstuff.org/grid-examples/data-grid/item-selection (this is 1.5-SNAPSHOT from 04 Oct 2011), select all items, try to deselect them. The last step doesn't work.

@akiraly
Copy link
Member

akiraly commented Oct 4, 2011

The problem is in c.i.g.column.CheckBoxColumn.HeadCheckBoxPanel line 347:

@Override
public CharSequence getCallbackUrl()
{
  return super.getCallbackUrl() + "&checked='+this.checked+'";
}

It seems super.getCallbackUrl() returns the last url received by ajax (== page parameters of the current request are propageted to the next request). So first it is:

`````` http://localhost:8080/data-grid/item-selection?3&checked=true```
and after that it gets
http://localhost:8080/data-grid/item-selection?checked=true&checked=false
and so on it is always longer.

Of course it starts working if I modify it like this:

@Override
public CharSequence getCallbackUrl()
{
  getPage().getPageParameters().remove("checked");
  return super.getCallbackUrl() + "&checked='+this.checked+'";
}

But it does not look correct to me.

Is this a correct wicket behavior? I would imagine in an ajax response super.getCallbackUrl() always returning the original url (without the parameters added by this behavior) not the last one.

@martin-g
Copy link
Member Author

martin-g commented Oct 5, 2011

Hm, this doesn't look correct indeed.
The question is: why the Ajax request parameters are stored in page's pageParameters.
page#getPageParameters() should return the parameters with which the initial page load happened. All Ajax requests may see and use them if they need but their request parameters shouldn't be stored in the page's parameters.

@akiraly
Copy link
Member

akiraly commented Oct 5, 2011

It is the MountedMapper.parseRequest() that populates the page parameters with the query parameters while wicket tries to figure out which request handler to use to handle the request. When I first click on the select all checkbox, this is what happens on the server:
uri received: data-grid/item-selection?1-1.IBehaviorListener.0-grid-header-header-checkBox-checkbox-checkbox&checked=true&random=0.7340454920195043
Stacktrace leading to add:

PageParameters.add(String, Object, int) line: 478   
PageParameters.add(String, Object) line: 450    
PageParametersEncoder.decodePageParameters(Request) line: 53    
MountedMapper(AbstractMapper).extractPageParameters(Request, int, IPageParametersEncoder) line: 152 
MountedMapper.extractPageParameters(Request, Url) line: 270 
MountedMapper.parseRequest(Request) line: 251   
MountedMapper(AbstractBookmarkableMapper).mapRequest(Request) line: 263 
SystemMapper(CompoundRequestMapper).mapRequest(Request) line: 130   
RequestCycle.resolveRequestHandler() line: 179  
RequestCycle.processRequest() line: 204 
RequestCycle.processRequestAndDetach() line: 251    
WicketFilter.processRequest(ServletRequest, ServletResponse, FilterChain) line: 162 
WicketFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 218

Both "checked" and "random" are added to the page parameters but "random" is cleaned out later in AbstractBookmarkableMapper.UrlInfo.cleanPageParameters(PageParameters).

Maybe AbstractBookmarkableMapper.processListener(PageComponentInfo, Class<? extends IRequestablePage>, PageParameters) should not reuse the extracted page parameters and use the one belonging to the existing page instance instead?

@akiraly
Copy link
Member

akiraly commented Oct 6, 2011

Probably the same issue as in https://issues.apache.org/jira/browse/WICKET-4109.

@martin-g
Copy link
Member Author

martin-g commented Oct 7, 2011

Should be fixed now with the commit in https://issues.apache.org/jira/browse/WICKET-4109

@martin-g martin-g closed this as completed Oct 7, 2011
@KlaGuMar
Copy link

KlaGuMar commented Jun 8, 2012

Sorry - but the problem is not fixed. When using CheckBoxColumn load rows and click on the header checkbox, then all checkboxes deactivate, the check mark disappears. After that it is not possible to check any row check box. What can I do?

@KlaGuMar
Copy link

It's my fault.I saw the com.inmethod.grid.examples and replaced the model within my implementation of IDataSource<>. Since using Detachable model, it works very well. Sorry for disturbing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants