Reinit TinySlider after ajax update
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
Replies (1)
Hi,
Sorry for the late reply. Can you please do the following changes for a workaround:
- Go to <code>core/html/src/js/components/app.js</code> and modify <code>createTinySliders</code> global TinySlider wrapper function as shown below:
Then access to the slider via it's DOM object:
<pre> const sliderEl = document.querySelector('#my_slider'); const sliderObj = KTUtil.data(sliderEl).get('tns'); sliderObj.rebuild(); // update the slider </pre>For more info please check the plugin's API docs <a href="https://github.com/ganlanyuan/tiny-slider">here</a.
Then recompile your assets folder with <a href="https://preview.keenthemes.com/html/metronic/docs/getting-started/build/gulp">Gulp</a> or <a href="https://preview.keenthemes.com/html/metronic/docs/getting-started/build/webpack">Webpack</a>.
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.