[attachment=0]TestTable_export.zip[/attachment]I have a paging table on a form (in a partial page) that displays rows from the database. I have a click event on several fields to detect when the user clicks a row in the table. This stopped working when my version 3.2.1 form was imported to version 4 and I have subsequently found that the events fire fine when the pagesize is set to null but when I set it to the number of rows I want to limit the table to, then I get an error claiming that the <object>onclick event is undefined whenever I click on one of the objects having an event.
(as an aside, I create a brand new project in WM4 to figure this out and found this to be true without the issue of upgrading from 3.2)
I have attached my simple test project.
(as an aside, I create a brand new project in WM4 to figure this out and found this to be true without the issue of upgrading from 3.2)
I have attached my simple test project.
Attachment
RE: click events lost when paging table pagesize is set
I hope you had a good Christmas and New Year.
I have been looking into this problem this morning, but unfortunately have not yet been able to replicate the issues you are seeing.
When testing your export I do seem to get the alert messages (eg +?+?++PagingTable1+?+?+?) when clicking the Choose buttons, regardless of the pageSize setting.
Are you able to replicate the problem using the preview option in the studio, eg by adjusting the example data in the page display document accordingly?
I had to make some changes to your project due to not having access to the database etc, so it is not exactly the same scenario as you are seeing.
If you can get the problem on a preview page, can you please send through a new export, and then I can test with the preview directly so that it will be exactly the same HTML that is causing issues for you.
It would also be helpful in narrowing down the problem to try using the paging table control on a full page rather than a partial page in case this is contributing to the issue.
Also, can you let me know what web browser you are using? There could well be a browser specific issue involved.
Regards,
Gerard
RE: click events lost when paging table pagesize is set
I'm not sure how to duplicate the problem in "preview" when there is no data for the table.
In any case, it turns out that this works OK when the table is in the main page (ie. not a partial page) however the project I converted needs to use a partial page to host this table.
I have attached a simplified version of my project which pastes the data into the page as an XML fragment. I get the same problem in IE9 and Firefox 13 which are the browsers I currently use. (although, as mentioned, only when the table appears in the partial page.)
Thanks
Scott
RE: click events lost when paging table pagesize is set
Thanks for this second project. I have been able to replicate the problem using this one.
As you are only seeing the problem when the paging table is on a partial page I suspect this is some kind of timing issue with the table being processed before it has been completely inserted into the page.
To try and resolve this I would suggest taking the script line from the +?+?++table_init+?+?+? custom field on the partial page, and instead place this script into an onload custom script event for the partial page. You will need to adjust the script slightly so that the reference to the getLastTableOutput function is replaced with a call to get the specific table to process.
As an example, for your second project export the script fragment in the onload event should be:
hyf.pagingtable.init(document.getElementById('PagingTable_2'), {enablePaging:true, pageSize:3, stripeRows:true});
Once you have added this onload event you should be able to remove the table_init custom field completely.
This change does seem to resolve the problem for me, but let me know how you get on.
With regards to the preview functionality, WebMaker uses the example input data document (shown on the bindings tab) as the base data when generating the previews. Therefore, if this document contains the data for 10 rows in a table for example, the table will have ten rows in the preview.
You can edit this document by selecting the Bindings tab on the Page Design screen, and using the edit links above the document tree (making sure that the Page Display Bindings accordion is currently selected). You should then use the Generate Page option to generate the updated preview file.
I hope this helps.
Regards,
Gerard
RE: click events lost when paging table pagesize is set
This did the trick. The table was working OK in version 3.2 so I automatically assumed there was something more devious happening under the covers somewhere...
My original project is back in business now.
RE: click events lost when paging table pagesize is set
I'm glad that got it working for you.
You shouldn't have needed to make any changes in this area when upgrading from v3.x to v4, so we will continue to investigate what is causing the timing issues.
In the mean time, this change is a reasonable solution to get the pages working correctly.
Regards,
Gerard