-
-
Notifications
You must be signed in to change notification settings - Fork 301
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
Cannot read properties of undefined (reading 'nextElementSibling') but works all right with yii\grid\GridView #1056
Comments
I did some more testing and found this is particularly caused by the GridVIew export function. If I enable the panel and export menu, the error goes away. I didn't need an export function for this grid so I didn't enable them, but grid view JS tries to initialize the function to these export buttons which does not exist thus the error. Also, I did some testing to get rid of an export menu on the demo page as well but it looks like the export menu is compulsory. |
Something pretty similar happened to me but error was:
Seems to be a BUG. Got this error with bootstrap 5, only workaround was to enable "panel" attribute
And export
|
similar issue, getting it with a very simple gridview the error:
the grid:
Bootstrap (v5.2.1): dropdown.js |
by disabling export the error is not thrown any more |
This is an issue in some script compatibility with yii2-bootstrap5 from v2.0.4 - while that is to be evaluated... current workaround is to use yii2-bootstrap5 v2.0.3 |
The fix for this for yiisoft/yii2-bootstrap5 versions >=2.0.4 depends on if the pull request is accepted at yiisoft/yii2-bootstrap5#54. As mentioned, till the fix is approved in yii2-bootstrap5, current workaround is to lock your yii2-bootstrap5 version to v2.0.3. Will need to otherwise figure out a way to delink the yii2-bootstrap5 library if the PR does not get accepted. |
Ok Kartik, We'll be waiting for the result. Thank you very much for your good activities |
Have done some enhancements to render layout parts better. Suggest to test if this resolves your yii2-bootstrap5 version issues. New release v3.5.1. |
Dear Kartik: I hope this message finds you well. I am writing to express my sincere gratitude for the swift and efficient resolution of the incident we encountered in kartik\grid\GridView. Your timely assistance and expertise were instrumental in getting things back on track. I am pleased to inform you that the issue has been successfully resolved, thanks to your diligent efforts. Your dedication and support have been invaluable in ensuring the smooth functioning of our systems. As we move forward, I would like to remind all users to ensure they are using the latest version of kartik\grid\GridView. Upgrading to the most recent version is crucial. Once again, thank you for your exceptional support in overcoming this challenge. Your commitment to excellence is truly appreciated by the entire users. |
@kartik-v I'm on
If I downgrade to |
@newadventure079 - am unable to reproduce your issue. Can you share your GridView configuration and code to reproduce your issue? You can cross check this on Krajee Grid Demos page which is on latest |
I can reproduce it with the same steps @TonisOrmisson gave. #1056 (comment)
I'm using |
I definitely cannot reproduce this for the scenario above on my test environment. Can you ensure you have the latest code and / or cross check your environment for any CACHING issues running outdated / stale code? |
Nothing is stale. I delete my web assets after each composer update. Also, when I use |
Sorry mate - cannot reproduce your issue. Here is a test link which works with a simple gridview config. |
I'm also seeing
on a different gridview |
After manually merging in yiisoft/yii2-bootstrap5#54 (with a couple of minor typo fixes), the error is no longer present using |
Not sure why. You actually do not need PR from yiisoft/yii2-bootstrap5#54 to be merged - if you somehow have confirmed you have the latest kartik-v/yii2-grid v3.5.1 - it should not need any other changes -- as tested in my local environment. It looks like some outdated code is running on your environment (to test you may want to check a brand new yii2 app install and implement this extension and retry). Seems @jabernalv has confirmed the issue is resolved. Will request others to check the same as well and let know. Thanks. |
I wiped out my entire vendor dir and re-ran composer. Below are the packages and their versions that I have Output
|
The problem is it's trying to render w2-button and it doesn't exist.
|
Which it should not with the latest release v3.5.1 ... and I wish to know how it is happening. Are you running opcache or something on your server which is serving stale cached code? Or is there some way for you to debug the same on any other environment? |
Yes, I uninstalled my entire vendor folder, removed yii-bootstrap-5 and kartik grid view from the composer.json file, then reinstalled them, and now everything works perfectly. This is my composer.json "php": ">=8.1.0", |
@kartik-v I'm using |
Yes. This is not related to this extension - suggest that this be an issue logged in that respective extension. Can you now confirm yii2-grid works as intended? |
I got it to work with plain |
FYI... Along with |
@kartik-v Thanks for the fixes! I was using |
You are welcome. To ensure prompter and more correct fixing - suggest if issues can be logged (and tested) in the right repository/extension to help debug the source of the issue and resolve. Thanks. |
I am getting Cannot read properties of undefined (reading 'nextElementSibling') in the console. This is consistent when I used the same grid code with different data in tabs, I am using BootStrap5. The grid on the first Tab seems to be ok but the select2 from the second tabs onwards keeps loading. FYI: I have set a unique ID for all grids and select2 and filters as well.
This is complete console error:
jquery.js?v=1671572081:4123 Uncaught TypeError: Cannot read properties of undefined (reading 'nextElementSibling') at Object.next (selector-engine.js:63:24) at Dropdown._getMenuElement (dropdown.js:270:27) at new Dropdown (dropdown.js:103:23) at HTMLDocument.<anonymous> (dashboard:10709:2) at mightThrow (jquery.js?v=1671572081:3830:29) at process (jquery.js?v=1671572081:3898:12)
I have tried enabling and disabling pjax for all loaded grids but no go. The only page I created among the error list is dashboard I checked the code there and the error points to
(new bootstrap.Dropdown('#w3-button', {}));
which was never found in DOM hence error? I disabled all filters in the grid but couldn't get it to go.I tried using yii\grid\GridView and the error disappeared and enabling all filter works alright. What could cause this in Kartik GridView?
The text was updated successfully, but these errors were encountered: