datagrid
datagrid copied to clipboard
Naja.load error when expanding the tree
Hello,
There is a problem when using Naja.js.
composer
ublaboo/datagrid": "^6.9
NPM
„ublaboo-datagrid“: „^6.7.1“
„naja“: „^2.1.5“,
expanding the tree at the top level will cause the javascript error below. Expanding the child or clicking at child's action reloads the page. It was working properly with nette.ajax.js.
Uncaught TypeError: naja.load is not a function
at dataGridLoad (datagrid.js:91)
at success (datagrid.js:671)
at EventTarget.<anonymous> (datagrid.js:28)
at EventTarget.makeRequest (Naja.ts:150)
Please help to resolve the issue.
Thank you
naja.load()
is a thing of the past, Naja hasn't been using the associated load
event since 1.5.0, and 2.0.0 dropped it entirely. I guess it should suffice to wrap the call here in if ( ! isNaja2()) { naja.load() }
🤔
I've added the condition and the error message is gone. Unfortunately expanding the child or clicking on child's action always reloads the whole page instead of ajax processing. There must be something else wrong.
I'm not familiar with the datagrid nor its treeview, but it seems that it's adding some elements to the page dynamically. The naja.load()
method might have been used to attach Naja's handling to these new elements; since Naja 1.6.0 there's a replacement method for that: naja.uiHandler.bindUI(element)