Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
10500 Lượt xem

Hello friends,

I am trying to add pagination feature in qweb template. i have filtered and display records using foreach so after completion of foreach loop i want to add pagination like current page, next and previous page. so it is possible using any inbuild functionality or using records count and page request using get method in form view??


Thanks in advance.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Haresh,

You have to render the pager values as below code.

model_ids = request.env[model_name].search([], offset=(page - 1) * 10, limit=10)
total = model_ids.search_count([])
pager = request.website.pager(
            url='url path',
            total=total,
            page=page,
            step=10,
        )

and you have to call website pager template in your custom template.

Thanks.





Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

yes, there is built in functionality to add pagination. see the "SHOP" menu, at the bottom of page there is pagination.

findout this below into odoo addons from where you will get an idea.

<div class="products_pager">
<t t-call="website.pager" />
</div>
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 23
1700
2
thg 5 24
31504
1
thg 1 17
8378
2
thg 11 16
6590
1
thg 3 15
3018