Ir al contenido
Menú
Se marcó esta pregunta
3 Respuestas
10651 Vistas

Hello everyo one


I am trying to make a dynamic carousel wich is displaying object from my model but when i want to use the dynamic carrousel it asks me to provide filter and template.

But i dont understand what it means and how to do this 


thx for your help

Avatar
Descartar
Mejor respuesta
Look for the free plugin in odoo apps where it has an example of dynamic acrrucel  apps name  is 
tn_carousel_category
Avatar
Descartar
Autor Mejor respuesta

Hello thx for your answer, i think the past it's a bit buggy, i'm gonna try it but it is for a simple slider isnt it ? how could i do to display 10 objects and when i click on the arrow it would display the 2nd to the 11st

Avatar
Descartar
Mejor respuesta

A dynamic carousel is a UI element that allows you to display a series of items, typically images or other media, in a rotating fashion. In Odoo, you can create a dynamic carousel by using the and tags in your XML file.

The tag is used to define the HTML templates that will be used to render each item in the carousel. The tag is used to specify the data that will be used to populate the templates.

Here's an example of how you might use these tags to create a dynamic carousel in Odoo:

Copy code
    t-name="CarouselItemTemplate">
        
class="carousel-item"> t-att-src="record.image_url" />
class="carousel-item-text">

t-field="record.name" />

t-field="record.description" />

name="object_ids" string="Objects" context="{'object_model': 'my.model'}"/> t-foreach="object_ids" t-as="record"> t-call="CarouselItemTemplate" t-options="{'record': record}" />

In this example, the CarouselItemTemplate template is defined in the tag. It includes an image and some text, which are bound to fields on the record object. The tag defines a field called object_ids, which is used to specify the objects that will be displayed in the carousel. The tag is used to define the carousel itself, and the tag is used to specify the individual items that will be displayed in the carousel. The t-foreach and t-as attributes are used to iterate over the object_ids field and bind each object to the record variable.

I hope this helps! Let me know if you have any further questions.


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
dic 22
2375
3
jun 22
11959
0
feb 22
1720
1
dic 24
4604
2
mar 22
4650