Hi keenthemes;
You have to be carefull what you put out there...
The assets folder that come by default with "8.1.5" is not the same persay witht the one that we compile with webpack.
and I've been hasstling for days to to just figure it out.
When I put my compiled "8.1.5" assets folder in my project, I got this error :
---> Uncaught TypeError: KTComponents.init is not a function
But when I put the defaut "8.1.5" assets folder that came witht the downloaded version of "8.15", no errors, everything went well.
I don't know why, but it appears that the components on ajax are well initialized if use your default "8.1.5" assets of the downloaded "8.1.5" by using :
KTComponents.init();
Hope you figure this out guys and put the exact one match ...
NB : It is days that we put to figure that our components not initialized. Please be sure to put the same Metronic for download than the one in your production.
Thank you Keenthemes.
Hi Keenthemes,
You can make this Post as resolved,
Thank you.
Hi riterix,
I did check the 8.1.5 demo1 package (ThemeForest), and the build is working. KTComponents.init function is also working fine.
This is the KTComponents file in the latest version on our GitHub. Do you have this file?
https://github.com/KeenthemesHub/Metronic/blob/master/html/demo1/src/js/components/_init.js
The error "KTComponents.init is not a function" seems it is missing.
Thanks
Hi Faizal, Thank' s for the reply, I do have that file,
BUT BUT BUT as I was expecting line by line, I found that my file in my end miss those last line in the end :
// Declare KTApp for Webpack support
if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
window.KTComponents = module.exports = KTComponents;
}
Hi Faizal,
The snippet above just did the work,
Everything works Perfectly *,
NO ERROR I CAN CONFIRM THAT. CLEAN.
Thank you
-------------------------------
Bu I got a little question :
I was using some old 8.1 code like initiat things :
KTUtil.onDOMContentLoaded(function () {
KTAppCalendar.init();
});
Uncaught ReferenceError: KTUtil is not defined
Hi Faizal,
I found what the matter with KTUtil.
I was doing a kind of extending the base.html for one level and another level doing some js, 2 levels of extend, and the script are not loaded after the script bundle.
I re position my custom scripts for select2 and other, put hem one level up,
And all Works now.
0 Error ;)
Now I have to Rethink the Layout and the decoupling of the Metronic Theme and the levels that I can't go over.
It is weird though, because it was working like a charm in Metronic 8.0.36, but the big Bootstrap 5.2 and you did a whole lots of writing and do , that caused this to fail, So we had to keep moving for update to 8.1.1 branch and ... It's good to find out.
Thank buddy. Thank you soo much
Hi riterix,
In the recent version, we did add this new js file for KTComponents.
/html/demo1/src/js/components/_init.js
And in the webpack file, we this line to import the plugin file.
/html/tools/webpack/scripts.demo1.js
window.KTComponents = require("@/src/js/components/_init.js");
Ohh Hi Faizal, thank's for the tip.
I went to "/html/tools/webpack/scripts.demo1.js" and the line "window.KTComponents = require('@/src/js/components/_init.js');" is already there. ...
I think that the problem is coming from somewhere else... You could take what I said above as a starting point, to identify the problem....
Until then Waiting for the fix...
NB : We can't go back to previous version, we already did a hell lots of editing because we wanted to be on the fresh updates of Metronic, AND WE CAN'T GO FORWARD because we have to have those functionalities (KTComponent init) because all project is based on a lots Ajax calls, and it need this KTComponent to be initialized.
If you need anything just le me know guys.
Thank you so much.
Still the same ...
Cnsole log error everywhere, LOL.
Any progress on this one ?
Thank you
Hi,
Thank you for bringing up this. Sure thing, we will quickly check it and get back to you shortly.
Regards.
Hi Sean,
Thank's for the the quick reply. hold on your answer soon,..
Thank you