|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
2021
Low
|
20
|
51%
19
|
3
|
33%
|
19
| |
Q1
Low
|
2
|
32%
36
|
15
|
52%
|
36
| |
January
Low
|
16
|
11%
28
|
13
|
47%
|
28
| |
10
High
|
34
|
97%
17
|
20
|
15%
|
17
| |
20
High
|
43
|
66%
9
|
26
|
47%
|
9
| |
February
Low
|
20
|
95%
43
|
26
|
83%
|
43
| |
15
Low
|
19
|
69%
23
|
8
|
75%
|
23
| |
2022
High
|
25
|
75%
32
|
5
|
45%
|
32
| |
Q1
Low
|
2
|
32%
36
|
15
|
52%
|
36
| |
January
Low
|
16
|
11%
28
|
13
|
47%
|
28
| |
15
High
|
34
|
97%
17
|
20
|
15%
|
17
| |
25
High
|
43
|
66%
9
|
26
|
47%
|
9
| |
May
Low
|
20
|
95%
43
|
26
|
83%
|
43
| |
2
Low
|
19
|
69%
23
|
8
|
75%
|
23
| |
2023
Low
|
10
|
65%
29
|
4
|
49%
|
29
| |
Q1
Low
|
2
|
32%
36
|
15
|
52%
|
36
| |
March
Low
|
16
|
11%
28
|
13
|
47%
|
28
| |
10
High
|
34
|
97%
17
|
20
|
15%
|
17
| |
11
High
|
43
|
66%
9
|
26
|
47%
|
9
| |
April
Low
|
20
|
95%
43
|
26
|
83%
|
43
| |
15
Low
|
19
|
69%
23
|
8
|
75%
|
23
|
The Advanced Table also allows for rendering custom components within individual Cells. To achieve this, you can make use of the optional custom_renderer item within each column_definitions. This function gives you access to the current Cell's value if you just want to use that with a custom Kit, but it also gives you access to the entire row object. The row object provides all data for the current row.
See here for more indepth information on column_definitions are how to use them.
See here for the structure of the table_data used.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], custom_renderer: ->(row, value) { capture do pb_rails("flex") do pb_rails("title", props: { text: value, size: 4 }) + pb_rails("badge", props: { dark: true, margin_left: "xxs", text: row[:newEnrollments].to_i > 20 ? "High" : "Low", variant: "neutral" }) end end } }, { accessor: "newEnrollments", label: "New Enrollments", custom_renderer: ->(row, value) { pb_rails("pill", props: { text: value, variant: "success" }) } }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", custom_renderer: ->(row, value) { content_tag(:a, value, href: "#") } }, { accessor: "attendanceRate", label: "Attendance Rate", custom_renderer: ->(row, value) { capture do pb_rails("flex", props: { align_items: "end", orientation: "column" }) do pb_rails("detail", props: { bold: true, color: "default", text: value }) + pb_rails("caption", props: { size: "xs", text: row[:graduatedStudents] }) end end } }, { accessor: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", label: "Class Completion Rate", }, { accessor: "graduatedStudents", label: "Graduated Students", } ] %> <%= pb_rails("advanced_table", props: { id: "custom_cell", table_data: @table_data, column_definitions: column_definitions }) %>
|
Year
|
New Enrollments
Whoa. I'm a Tooltip
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
January
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
10
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
20
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
February
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
15
|
19
|
35
|
69%
|
8
|
75%
|
23
|
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
January
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
15
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
25
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
May
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
2
|
19
|
35
|
69%
|
8
|
75%
|
23
|
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
March
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
10
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
11
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
April
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
15
|
19
|
35
|
69%
|
8
|
75%
|
23
|
The optional header item can be used within column_definitions to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", header: ->(cell, label) { capture do pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do pb_rails("caption", props: { margin_right: "xs", text: "New Enrollments" }) + pb_rails("icon", props: { id: "tooltip-interact", icon: "info", size: "xs", cursor: "pointer" }) + pb_rails("tooltip", props: { trigger_element_id: "tooltip-interact", tooltip_id: "example-custom-tooltip", position: "top", z_index: "10" }) do "Whoa. I'm a Tooltip" end end end } }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, { accessor: "attendanceRate", label: "Attendance Rate", }, { accessor: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", label: "Class Completion Rate", }, { accessor: "graduatedStudents", label: "Graduated Students", } ] %> <%= pb_rails("advanced_table", props: { id: "custom_header_table", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
Enrollment Data
Whoa. I'm a Tooltip
|
Performance Data
|
||||
|---|---|---|---|---|---|---|
|
|
Enrollment Stats
|
Completion Metrics
|
Attendance
Whoa. I'm a Tooltip Too!
|
|||
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Completed Classes
|
Class Completion Rate
|
Attendance Rate
|
Scheduled Meetings
|
|
2021
|
20
|
10
|
3
|
33%
|
51%
|
10
|
|
Q1
|
2
|
35
|
15
|
52%
|
32%
|
35
|
|
January
|
16
|
20
|
13
|
47%
|
11%
|
20
|
|
10
|
34
|
28
|
20
|
15%
|
97%
|
28
|
|
20
|
43
|
23
|
26
|
47%
|
66%
|
23
|
|
February
|
20
|
41
|
26
|
83%
|
95%
|
41
|
|
15
|
19
|
35
|
8
|
75%
|
69%
|
35
|
|
2022
|
25
|
17
|
5
|
45%
|
75%
|
17
|
|
Q1
|
2
|
35
|
15
|
52%
|
32%
|
35
|
|
January
|
16
|
20
|
13
|
47%
|
11%
|
20
|
|
15
|
34
|
28
|
20
|
15%
|
97%
|
28
|
|
25
|
43
|
23
|
26
|
47%
|
66%
|
23
|
|
May
|
20
|
41
|
26
|
83%
|
95%
|
41
|
|
2
|
19
|
35
|
8
|
75%
|
69%
|
35
|
|
2023
|
10
|
15
|
4
|
49%
|
65%
|
15
|
|
Q1
|
2
|
35
|
15
|
52%
|
32%
|
35
|
|
March
|
16
|
20
|
13
|
47%
|
11%
|
20
|
|
10
|
34
|
28
|
20
|
15%
|
97%
|
28
|
|
11
|
43
|
23
|
26
|
47%
|
66%
|
23
|
|
April
|
20
|
41
|
26
|
83%
|
95%
|
41
|
|
15
|
19
|
35
|
8
|
75%
|
69%
|
35
|
The optional header item within column_definitions can also be used with multi headers as seen here.
<% column_definitions = [ { accessor: "year", label: "Year", id: "year", cellAccessors: ["quarter", "month", "day"], }, { label: "Enrollment Data", id: "enrollmentData", header: ->(cell, label) { capture do pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do pb_rails("caption", props: { margin_right: "xs", text: "Enrollment Data" }) + pb_rails("icon", props: { id: "tooltip-interact-multi", icon: "info", size: "xs", cursor: "pointer" }) + pb_rails("tooltip", props: { trigger_element_id: "tooltip-interact-multi", tooltip_id: "example-custom-tooltip-multi", position: "top", z_index: "10" }) do "Whoa. I'm a Tooltip" end end end }, columns: [ { label: "Enrollment Stats", id: "enrollmentStats", columns: [ { accessor: "newEnrollments", id: "newEnrollments", label: "New Enrollments", }, { accessor: "scheduledMeetings", id: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, ], }, { label: "Performance Data", id: "performanceData", columns: [ { label: "Completion Metrics", id: "completionMetrics", columns: [ { accessor: "completedClasses", id: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", id: "classCompletionRate", label: "Class Completion Rate", }, ], }, { label: "Attendance", id: "attendance", header: ->(cell, label) { capture do pb_rails("flex", props: { align_items: "center", justify_content: "center" }) do pb_rails("caption", props: { margin_right: "xs", text: "Attendance" }) + pb_rails("icon", props: { id: "tooltip-interact-multi-2", icon: "info", size: "xs", cursor: "pointer" }) + pb_rails("tooltip", props: { trigger_element_id: "tooltip-interact-multi-2", tooltip_id: "example-custom-tooltip-multi-2", position: "top", z_index: "10" }) do "Whoa. I'm a Tooltip Too!" end end end }, columns: [ { accessor: "attendanceRate", id: "attendanceRate", label: "Attendance Rate", }, { accessor: "scheduledMeetings", id: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, ], }, ] %> <%= pb_rails("advanced_table", props: { id: "custom_header_multi_header_table", table_data: @table_data, column_definitions: column_definitions }) %>
| Props | Type | Values |
|---|---|---|
align_content |
enum | responsive
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
align_items |
enum | responsive
|
start
end
center
|
border_radius |
enum
|
none
xs
sm
md
lg
xl
rounded
|
cursor |
enum
|
auto
default
none
contextMenu
help
pointer
progress
wait
cell
|
dark |
boolean
|
true
false
|
flex |
enum | responsive
|
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none
|
flex_direction |
enum | responsive
|
row
column
rowReverse
columnReverse
|
flex_wrap |
enum | responsive
|
wrap
nowrap
wrapReverse
|
justify_content |
enum | responsive
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
line_height |
enum
|
loosest
looser
loose
normal
tight
tighter
tightest
|
margin_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin |
array
|
none
xxs
xs
sm
md
lg
xl
|
width |
string
|
|
min_width |
string
|
|
max_width |
string
|
|
gap |
string | responsive
|
|
column_gap |
string | responsive
|
|
row_gap |
string | responsive
|
|
number_spacing |
enum
|
tabular
|
order |
enum | responsive
|
none
first
1
2
3
4
5
6
7
8
9
10
11
12
|
overflow_x |
enum
|
scroll
visible
hidden
auto
|
overflow_y |
enum
|
scroll
visible
hidden
auto
|
overflow |
enum
|
scroll
visible
hidden
auto
|
padding_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding |
array
|
none
xxs
xs
sm
md
lg
xl
|
position |
enum
|
relative
absolute
fixed
sticky
static
|
shadow |
enum
|
none
deep
deeper
deepest
|
text_align |
enum | responsive
|
start
end
left
right
center
justify
justifyAll
matchParent
|
truncate |
enum
|
none
1
2
3
4
5
|
vertical_align |
enum | responsive
|
baseline
super
top
middle
bottom
sub
text-top
text-bottom
|
z_index |
enum | responsive
|
1
2
3
4
5
6
7
8
9
10
max
|
top |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
inset |
boolean
|
true
false
|
right |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
bottom |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
left |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
height |
string
|
|
max_height |
string
|
|
min_height |
string
|
|
hover |
object
|
|
group_hover |
boolean
|
true
false
|
| Props | Type | Values | Default |
|---|---|---|---|
actions |
react.reactnode[] | react.reactnode
|
||
cascade_collapse |
boolean
|
true
false
|
|
column_definitions |
array
|
||
column_group_border_color |
enum
|
text_lt_default
text_lt_light
text_lt_lighter
text_dk_default
text_dk_light
text_dk_lighter
|
none
|
column_visibility_control |
genericobject
|
||
custom_sort |
boolean
|
true
false
|
|
enable_toggle_expansion |
enum
|
all
header
none
|
header
|
enable_sorting_removal |
boolean
|
true
false
|
|
expanded_control |
genericobject
|
||
expand_by_depth |
array
|
||
on_expand_by_depth_click |
function
|
||
initial_loading_rows_count |
number
|
||
inline_row_loading |
boolean
|
true
false
|
false
|
loading |
boolean | string
|
false
|
|
on_row_toggle_click |
function
|
||
on_toggle_expansion_click |
function
|
||
pagination |
boolean
|
true
false
|
|
pagination_props |
genericobject
|
||
pinned_rows |
genericobject
|
||
responsive |
enum
|
scroll
none
|
scroll
|
row_styling |
array
|
||
scroll_bar_none |
boolean
|
true
false
|
false
|
selectable_rows |
boolean
|
true
false
|
false
|
show_actions_bar |
boolean
|
true
false
|
true
|
persist_toggle_expansion_button |
boolean
|
true
false
|
false
|
sort_control |
genericobject
|
||
sort_parent_only |
boolean
|
true
false
|
|
sticky_left_column |
array
|
||
table_data |
array
|
||
table_options |
genericobject
|
||
table_props |
genericobject
|
||
toggle_expansion_icon |
string | string[]
|
||
on_row_selection_change |
function
|
||
on_custom_sort_click |
function
|
||
virtualized_rows |
boolean
|
true
false
|
|
allow_full_screen |
boolean
|
true
false
|
|
full_screen_control |
function
|
||
enable_sorting |
boolean
|
true
false
|
|
sort_icon |
string | string[]
|
||
collapsible_trail |
boolean
|
true
false
|
|
sub_row_headers |
array
|