Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Commit 5960e82

Browse files
nzaterrenceTom Blauwendraat
authored andcommitted
[ADD] web_widget_x2many_2d_matrix_freeze module
1 parent 6ea5839 commit 5960e82

9 files changed

Lines changed: 490 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3+
:alt: License: AGPL-3
4+
5+
================================================
6+
Web freeze table columns and rows on matrix view
7+
================================================
8+
9+
This module extends the functionality of `web_widget_x2many_2d_matrix`
10+
to add the option of making the first matrix column or row sticky,
11+
for easy viewing when user scrolls through the matrix.
12+
13+
Usage
14+
=====
15+
16+
On the field definition, add sticky="true" option to enable stickiness on the matrix::
17+
18+
<field name="planning_ids" widget="widget="x2many_2d_matrix" ... sticky="True"/>
19+
20+
When user navigates to the matrix view, the table header and first column are frozen
21+
on X and Y axis scroll.
22+
23+
It is possible to specify how many columns to stick by configuring it::
24+
25+
<field ... sticky="True" sticky_x="2"/>
26+
27+
Credits
28+
=======
29+
30+
Uses library jquery.stickytableheaders.js by Jonas Mosbech
31+
(https://github.com/jmosbech/StickyTableHeaders)
32+
33+
Contributors
34+
------------
35+
36+
* Terrence Nzaywa, Sunflower IT <terrence@sunflowerweb.nl>
37+
* Tom Blauwendraat, Sunflower IT <tom@sunflowerweb.nl>
38+
39+
Maintainer
40+
----------
41+
42+
This module is maintained by Therp BV <https://therp.nl/>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2018-2019 Sunflower IT <http://therp.nl>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
from . import wizard
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2018-2019 Sunflower IT <http://therp.nl>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
{
6+
"name": "Web freeze matrix table columns and rows",
7+
"version": "8.0.1.0.0",
8+
"author": "Sunflower IT, Therp BV",
9+
"license": "AGPL-3",
10+
"category": "Web Widgets",
11+
"summary": "Web freeze matrix table columns and rows",
12+
"depends": [
13+
'web_widget_x2many_2d_matrix'
14+
],
15+
"demo": [
16+
"demo/demo_matrix.xml"
17+
],
18+
"data": [
19+
"views/web_matrix_view_sticky.xml"
20+
],
21+
'installable': True,
22+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0"?>
2+
<openerp>
3+
<data>
4+
5+
<record model="ir.ui.view" id="demo_matrix_view">
6+
<field name="name">Sticky matrix</field>
7+
<field name="model">web.widget.x2many.matrix.demo.wizard</field>
8+
<field name="arch" type="xml">
9+
<form string="Demo matrix">
10+
<field name="line_ids"
11+
nolabel="1"
12+
widget="x2many_2d_matrix"
13+
field_value="projected_sales"
14+
field_y_axis="partner_id"
15+
field_label_y_axis="partner_name"
16+
field_x_axis="country_id"
17+
field_label_x_axis="country_name"
18+
sticky="True"/>
19+
</form>
20+
</field>
21+
</record>
22+
23+
<record model="ir.actions.act_window" id="demo_matrix_action">
24+
<field name="name">Sticky matrix</field>
25+
<field name="res_model">web.widget.x2many.matrix.demo.wizard</field>
26+
<field name="view_type">form</field>
27+
<field name="view_mode">form</field>
28+
<field name="usage">menu</field>
29+
</record>
30+
31+
<menuitem
32+
id="demo_matrix_menu"
33+
parent="base.menu_management"
34+
action="demo_matrix_action"
35+
sequence="100"/>
36+
37+
<record model="ir.ui.view" id="demo_matrix2_view">
38+
<field name="name">Sticky matrix (2 columns)</field>
39+
<field name="model">web.widget.x2many.matrix.demo.wizard</field>
40+
<field name="arch" type="xml">
41+
<form string="Demo matrix">
42+
<field name="line_ids"
43+
nolabel="1"
44+
widget="x2many_2d_matrix"
45+
field_value="projected_sales"
46+
field_y_axis="partner_id"
47+
field_label_y_axis="partner_name"
48+
field_x_axis="country_id"
49+
field_label_x_axis="country_name"
50+
sticky="True"
51+
sticky_x="2"/>
52+
</form>
53+
</field>
54+
</record>
55+
56+
<record model="ir.actions.act_window" id="demo_matrix2_action">
57+
<field name="name">Sticky matrix (2 columns)</field>
58+
<field name="res_model">web.widget.x2many.matrix.demo.wizard</field>
59+
<field name="view_type">form</field>
60+
<field name="view_mode">form</field>
61+
<field name="view_id" ref="demo_matrix2_view"/>
62+
<field name="usage">menu</field>
63+
</record>
64+
65+
<menuitem
66+
id="demo_matrix2_menu"
67+
parent="base.menu_management"
68+
action="demo_matrix2_action"
69+
sequence="100"/>
70+
71+
</data>
72+
</openerp>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.sticky-wrap {
2+
overflow-x: auto;
3+
overflow-y: hidden;
4+
position: relative;
5+
margin: 3em 0;
6+
width: 100%;
7+
}
8+
.sticky-wrap .sticky-thead,
9+
.sticky-wrap .sticky-col,
10+
.sticky-wrap .sticky-intersect {
11+
opacity: 0;
12+
position: absolute;
13+
top: 0;
14+
left: 0;
15+
transition: all .125s ease-in-out;
16+
z-index: 50;
17+
width: auto; /* Prevent table from stretching to full size */
18+
}
19+
.sticky-wrap .sticky-thead {
20+
box-shadow: 0 0.25em 0.1em -0.1em rgba(0,0,0,.125);
21+
z-index: 100;
22+
width: 100%; /* Force stretch */
23+
}
24+
.sticky-wrap .sticky-intersect {
25+
opacity: 1;
26+
z-index: 150;
27+
28+
}
29+
.sticky-wrap .sticky-intersect th {
30+
background-color: #666;
31+
color: #eee;
32+
}
33+
.sticky-wrap td,
34+
.sticky-wrap th {
35+
box-sizing: border-box;
36+
}
37+
38+
.sticky-wrap th {
39+
border-bottom: solid #dfdfdf 1px;
40+
}
41+
42+
.sticky-wrap.overflow-y {
43+
overflow-y: auto;
44+
/*max-height: 50vh;*/
45+
max-height: 200px;
46+
}
47+
.sticky-wrap table.sticky-enabled {
48+
margin: 0;
49+
width: "100%";
50+
}

0 commit comments

Comments
 (0)