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:
1. Go to 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");
});
}
const sliderEl = document.querySelector("#my_slider");
const sliderObj = KTUtil.data(sliderEl).get("tns");
sliderObj.rebuild(); // update the slider