Greetings! I'm having a hard time figuring this out with the KT integration. I have some cards loaded into a tiny slider. They scroll and everything works as expected, except data updated via ajax isn't displayed on the cards. The scrolling cards only show the dummy data from the initial page load. This makes sense, because that is what was on the cards when the tiny slider was initialized. How can I tell the tiny slider to re-initialize?
Cheers,
Ajar
Hi,
Sorry for the late reply. Can you please do the following changes for a workaround:
core/html/src/js/components/app.js and modify createTinySliders global TinySlider wrapper function as shown below:
var createTinySliders = function () {
if (typeof tns === 'undefined') {
return;
}
// Sliders
const elements = Array.prototype.slice.call(document.querySelectorAll('[data-tns="true"]'), 0);
if (!elements && elements.length === 0) {
return;
}
elements.forEach(function (el) {
if (el.getAttribute("data-kt-initialized") === "1") {
return;
}
const obj = initTinySlider(el);
KTUtil.data(el).set('tns', tns);
el.setAttribute("data-kt-initialized", "1");
});
}
Then access to the slider via it's DOM object:
const sliderEl = document.querySelector('#my_slider');
const sliderObj = KTUtil.data(sliderEl).get('tns');
sliderObj.rebuild(); // update the slider
For more info please check the plugin's API docs here</a.
Then recompile your assets folder with Gulp or Webpack.
Please note that the build tools are required only in the development environment just to compile the assets when the source folder files are modified. In the hosting/server deployment, you will only need the compile assets, no need to install the build tools dependencies there.
Regards.