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

getSettingsObjFromTable(...) is undefined : When Jquery.Remove() and ScrollY actif #619

Open
bourasseaun opened this issue Feb 28, 2020 · 4 comments

Comments

@bourasseaun
Copy link

Hello,
When i do an $(...).remove() on a Div with Datatable inside (with yadcf).
And try to recreate this SAME div, i got this error :

jquery.dataTables.yadcf.js:804 Uncaught TypeError: Cannot read property 'sTableId' of undefined
at getTableId (jquery.dataTables.yadcf.js:804)
at appendFilters (jquery.dataTables.yadcf.js:3048)
at HTMLTableElement. (jquery.dataTables.yadcf.js:4641)
at HTMLDocument.dispatch (jquery.min.js:2)
at HTMLDocument.v.handle (jquery.min.js:2)
at Object.trigger (jquery.min.js:2)
at HTMLTableElement. (jquery.min.js:2)
at Function.each (jquery.min.js:2)
at k.fn.init.each (jquery.min.js:2)
at k.fn.init.trigger (jquery.min.js:2)

After some investigation, i see what cause the error :

  • Without Yadcf, that work perfectly
  • Without parameter ScrollY, that work perfectly
  • Without parameter Ajax, that work perfectly.
@vedmack
Copy link
Owner

vedmack commented Mar 1, 2020

@bourasseaun please provide a minimal test page showing this issue

@Eddie-Fantastic
Copy link

I have the same issue, if scroller is used and the table is reloaded via ajax then I get the above error.
The first time dt is loaded it work fine, just the reload shows the error and no table displayed. Without yadcf it works fine, without dt scroller it works fine.
Is this project still active? I can build a test page to display this if so.
Thanks

@Eddie-Fantastic
Copy link

I'm no js programmer but I tried random things in the code. This issue stems within appendFilters() where getTableId() is called.
If I comment out the line below (scrollXYHandler(...)) the bug appears to be fixed. I have yet to find any new issues caused by this.

			if (settingsDt.oScroll.sX !== '' || settingsDt.oScroll.sY !== '') {
				table_selector = '.yadcf-datatables-table-' + table_selector_jq_friendly;
				if ($(table_selector).length === 0) {
                                        /*
                                         *  fix for ajax scroller bug
                                         */
					//scrollXYHandler(oTable, '#' + getTableId(oTable));
				}
			}

@Eddie-Fantastic
Copy link

Ignore above code, causes issues when dt data is inserted via ajax.
Code below seems to be causing no issues

			if (settingsDt.oScroll.sX !== '' || settingsDt.oScroll.sY !== '') {
				table_selector = '.yadcf-datatables-table-' + table_selector_jq_friendly;
                                /*
                                 * fix for ajax scroller bug
                                 */
                                var settings = getSettingsObjFromTable(oTable);
				if ($(table_selector).length === 0 && typeof settings !== 'undefined') {
					scrollXYHandler(oTable, '#' + getTableId(oTable));
				}
			}

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

No branches or pull requests

3 participants