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

Multiple DataTables on the page cause error when paginating or filtering #285

Closed
XaeroDegreaz opened this issue Feb 4, 2016 · 5 comments
Assignees
Labels
Milestone

Comments

@XaeroDegreaz
Copy link
Contributor

@stephanrauh @TheCoder4eu
#279 Introduced a bug :(

I'm looking into the below stack trace, and seeing how the JSF tries to figure out the forms. Perhaps I've invoked the BsF.ajax() call incorrectly?

This affects all pages with multiple DataTables on them whether or not they are using the new attributes.

In any case, I'd recommend either backing out the merge request #281 if you want to release any artifacts, or postponing any releasing of artifacts until I can complete one of these and get you to merge it into master:

  • Limit the scope of the breakage (mask the bug), e.g. do not break pre-DataTable option that allows the state of the table to last between refreshes / re-rendering #279 multiple DataTable pages by only performing the BsF.ajax() calls when the dataTableProperties attribute is set. Explain that this iteration of the attribute is a feature-in-progress and only works with a single DataTable per-page.
  • Add some JavaScript error handling for these calls so that they fail gracefully, but still outline that the persistence map is still a WIP.
Uncaught clientError: Sourceform could not be determined, either because element is not attached to a form or we have multiple forms with named elements of the same identifier or name, stopping the ajax processing

jsf.js.jsf?ln=javax.faces&stage=Development:8735

I'm continuing to investigate, and will get a quick-fix PR put together ASAP in order to mask the bug. Sorry for my carelessness, I can't believe I didn't test this sooner.

XaeroDegreaz pushed a commit to XaeroDegreaz/BootsFaces-OSP that referenced this issue Feb 4, 2016
…leProperties attribute is set. this is a quick fix commit so that the buck does not impact current users with multiple datatables
XaeroDegreaz pushed a commit to XaeroDegreaz/BootsFaces-OSP that referenced this issue Feb 4, 2016
…ate the setter to explain this is still an experimental feature and yet lacks the ability to work when multiple data tables are on the same page.
@XaeroDegreaz
Copy link
Contributor Author

Ok, pull request is in, but I'd request that this issue not be closed, as this is still an open bug and I'll still be searching for the actual solution to the root problem.

The fix makes sure the error doesn't bubble up and break normal functionality with searching and stuff.

XaeroDegreaz added a commit to XaeroDegreaz/BootsFaces-OSP that referenced this issue Feb 5, 2016
… notation which breaks jquery selectors. since the wrapper for the datatable is generated from the true id of the datatable by the client-side framework, we must escape the ":" in the selector.
@XaeroDegreaz
Copy link
Contributor Author

Ok, so I've had some more time to play with this bug.

I first encountered it when testing the snapshot on a project at work that had multiple tables on the page. I've since masked that, but when I tried on a personal test project at home, the bug never actually happened!

I think there must be some funny difference in a form on the page or something. So while testing having forms on the page, and DataTables in form, I encountered the same bug as #241.

The rendering fix inside #272 uses a JQuery selector to select the wrapper that is generated for the DataTable. That wrapper gets its ID attribute from the TRUE DataTable ID. So when it's in a form it looks like FormID:DataTableID. The : is an invalid character in a JQuery selector so it blows up. In order to combat that I had to escape it so that it was valid according to the accepted answer in this post.

I'm not entirely certain if this fixes the situation with the project at work, but I will verify that when I have a chance.

I know I type a lot, but I find it important to document everything :)

@stephanrauh
Copy link
Collaborator

I've merged your pull request to the master branch of BootsFaces (i.e. BootsFaces 0.8.2-SNAPSHOT). I've also uploaded the new developer snapshot to Maven Central (see #151). If this solves the bug, feel free to close this issue. In any case, please report back.

Thanks in advance
Stephan

@stephanrauh stephanrauh added this to the v0.8.2 milestone Feb 10, 2016
@stephanrauh stephanrauh self-assigned this Feb 10, 2016
@XaeroDegreaz
Copy link
Contributor Author

I tested it with my work project and still haven't figured out what's causing it to fail in that particular project. There has to be something 'special' about that project. Has to be something with an errant form or something.

I've spun up several different personal projects testing multiple tables and there are no issues.

I'll keep investigating. In the meantime, if you want to just assign this ticket to me, or close this one and I can open another PR in the future if I find out the root cause to be something on the framework side.

@XaeroDegreaz
Copy link
Contributor Author

I'm going to close this issue as the core issue Multiple DataTables on the page cause error when paginating or filtering has been solved.

I have been unable to replicate the failures in new projects since the fix, and there must be some special circumstance with the codebase with which I initially discovered this issue.

Any other projects out there that experience this bug will fail gracefully, and there will be errors in the JavaScript console. If you're somehow able to replicate this bug in a project, I guess you can reopen this ticket or create a new issue with exact information as how to produce the bug, and I'd be happy to fix it.

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

2 participants