vedmack / yadcf

Yet Another DataTables Column Filter (yadcf)

Home Page:http://yadcf-showcase.appspot.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

bourasseaun opened this issue · comments

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.

@bourasseaun please provide a minimal test page showing this issue

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

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));
				}
			}