Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
12684 Tampilan

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
Buang
Jawaban Terbai
Look for the free plugin in odoo apps where it has an example of dynamic acrrucel  apps name  is 
tn_carousel_category
Avatar
Buang
Penulis Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Des 22
2729
3
Jun 22
12984
0
Feb 22
2087
1
Des 24
5033
2
Mar 22
5265