|
Year
|
New Enrollments
|
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 AdvancedTable kit accepts tree data and automatically renders expansion controls for nested subrows, to any depth, based on the data it is given. In it's simplest form, the kit has three required props:
A unique id is required to allow the table functionality to work properly. Without it, certain functions like the action bar, expand/collapse caching, or selectable rows will not be able to properly reference the correct table.
You must also set table_id when using subcomponents like table_header or table_body.
table_data accepts an array of objects as the table data. Each object is a table row, and each key:value pair within an object is a column value within that row. Nested children within a data object are automatically rendered as subrows under their parent row.
For a visual of the data structure needed for table_data, see here.
Column definitions are the single most important part of building a table as they are responsible for building the underlying data model that is used for all sorting, expansion, etc. column_definitions in the AdvancedTable kit is an array of objects as seen in the code snippet below. Each object within the array has two REQUIRED items:
accessor: this is the key from your data for the value you want rendered in that columnlabel: this is what will be rendered as the column header labelThere is also one optional item that is only required if the table has nested data:
cellAccessors: This is an array of strings that represent keys from your data object. This is only required for the first column in case of nested data. If you have nested data, the AdvancedTable needs to know what to render in that first column for nested items. This array represents the nested data in the order you want it rendered.<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "beta_table", table_data: @table_data, column_definitions: column_definitions }) %>
|
Year
|
New Enrollments
|
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 loading prop takes a boolean value that can be managed using state. If loading is true, the table will display the loading skeleton and once loading is false, the table will render with the data provided.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "loading_table", table_data: @table_data, column_definitions: column_definitions, loading: true }) %>
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
|
|
Quarter
|
|
|
|
|
|
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
Month
|
|
|
|
|
|
|
|
January
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
Day
|
|
|
|
|
|
|
|
10
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
20
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
February
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
Day
|
|
|
|
|
|
|
|
15
|
19
|
35
|
69%
|
8
|
75%
|
23
|
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
|
|
Quarter
|
|
|
|
|
|
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
Month
|
|
|
|
|
|
|
|
January
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
Day
|
|
|
|
|
|
|
|
15
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
25
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
May
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
Day
|
|
|
|
|
|
|
|
2
|
19
|
35
|
69%
|
8
|
75%
|
23
|
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
|
|
Quarter
|
|
|
|
|
|
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
Month
|
|
|
|
|
|
|
|
March
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
Day
|
|
|
|
|
|
|
|
10
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
11
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
April
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
Day
|
|
|
|
|
|
|
|
15
|
19
|
35
|
69%
|
8
|
75%
|
23
|
subrow_headers is an optional prop that if present will add header rows at each level of the nested data. The prop takes an array of strings, each string being the text for each header row. The array of strings must be in the order in which they need to be rendered in the UI according to depth.
enable_toggle_expansion is an additional optional prop that can be used in conjunction with the subRowHeaders prop. enable_toggle_expansion is a string that can be "all", "header" or "none". If set to "all", the toggle expansion button will appear in the table header as well as in the subRow headers. If set to "header", the button will only appear in header and NOT in subRow headers. This prop is set to "header" by default.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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", } ] subrow_headers = ["Quarter", "Month", "Day"] %> <%= pb_rails("advanced_table", props: { id: "subrow-headers", table_data: @table_data, column_definitions: column_definitions, id: "test_table" }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "subrow-headers", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "subrow-headers", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %> <% end %>
|
Year
|
New Enrollments
|
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
|
collapsible_trail is an optional prop that is set to 'true' by default. If set to 'false', it will remove the trail on the left of the rows when subRows are toggled open.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "collapsible_trail", table_data: @table_data, column_definitions: column_definitions }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "collapsible_trail", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "collapsible_trail", table_data: @table_data, column_definitions: column_definitions, collapsible_trail: false }) %> <% end %>
|
Year
|
New Enrollments
|
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
|
This kit uses the Table kit under the hood which comes with its own set of props. If you want to apply certain Table props to that underlying kit, you can do so by using the optional table_props prop. This prop must be an object that contains valid Table props. For a full list of Table props, see here.
This doc example showcases the use of two table props, including how to render the vertical borders between columns.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "table_props_table", table_data: @table_data, column_definitions: column_definitions, table_props: { vertical_border: true, container: false }}) %>
|
Year
|
New Enrollments
|
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 table_props prop can also be used to render a sticky header for the Advanced Table.
This doc example showcases how to set a sticky header for a nonresponsive table (see the responsive prop set to "none"). To achieve sticky header AND responsive functionality, see the "Sticky Header for Responsive Table" doc example below.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "sticky_header_table", table_data: @table_data, column_definitions: column_definitions, responsive: "none", table_props: { sticky: true }}) %>
|
Year
|
New Enrollments
|
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
|
Create a sticky header that works for responsive Advanced Tables by setting sticky: true via table_props and giving the AdvancedTable a max_height using our Max Height global prop.
NOTE: This behavior requires a max_height to work. The header is sticky within the table container, allowing for it to work along with the first column stickiness of a responsive table on smaller screen sizes.
Expand the table above to see this in action.
A sticky header on a nonresponsive table is demonstrated in the "Sticky Header" doc example above.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "table_props_sticky_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", table_props: { sticky: true }}) %>
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
|
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
|
|
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
|
|
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
|
Use the pinned_rows prop to pin specific rows to the top of an Advanced Table. Pinned rows will remain at the top when scrolling through table data and will not change position if sorting is used.
NOTE:
sticky: true via table_props (works with both responsive and non-responsive tables)table_data array must contain a unique id in order to attach an id to all Rows for this to function.pinned_rows takes a hash with a top key containing an array of row ids, as shown in the code snippet below.pinned_rows[:top]; all its children will automatically be pinned with it. If a child id is passed without the parent being pinned, nothing will be pinned.<%# Example sort method for demonstration purposes %> <% if params["sort"] %> <% sort_param = params["sort"].gsub(/_(asc|desc)\z/, "") %> <% sort_direction = params["sort"].end_with?("_asc") ? 1 : -1 %> <% @table_data_with_id.sort! do |a, b| value_a = a[sort_param] || a[sort_param.to_sym] value_b = b[sort_param] || b[sort_param.to_sym] value_a = value_a.to_i if value_a.is_a?(String) && value_a.match?(/^\d+$/) value_b = value_b.to_i if value_b.is_a?(String) && value_b.match?(/^\d+$/) sort_direction * (value_a <=> value_b) end %> <% end %> <% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], sort_menu: [ { item: "Year", link: "?sort=year_asc#pinned_rows_table", active: params["sort"] == "year_asc", direction: "asc" }, { item: "Year", link: "?sort=year_desc#pinned_rows_table", active: params["sort"] == "year_desc", direction: "desc" } ], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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", } ] %> <% pinned_rows = { top: ["8"] } %> <%= pb_rails("advanced_table", props: { id: "pinned_rows_table", table_data: @table_data_with_id, column_definitions: column_definitions, max_height: "xs", pinned_rows: pinned_rows, responsive: "none", table_props: { sticky: true }}) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "pinned_rows_table", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "pinned_rows_table", table_data: @table_data_with_id, column_definitions: column_definitions, pinned_rows: pinned_rows }) %> <% end %>
|
Year
|
New Enrollments
|
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
|
Optionally enable sorting by passing sort_menu to any column_definition(s). Sort options are determined by an array of item objects passed to the sort_menu prop.
This example uses a custom sort method that may need to be modified or replaced within your project.
<%# Example sort method for demonstration purposes %> <% if params["sort"] %> <% sort_param = params["sort"].gsub(/_(asc|desc)\z/, "") %> <% sort_direction = params["sort"].end_with?("_asc") ? 1 : -1 %> <% @table_data.sort! do |a, b| value_a = a[sort_param] value_b = b[sort_param] value_a = value_a.to_i if value_a.is_a?(String) && value_a.match?(/^\d+$/) value_b = value_b.to_i if value_b.is_a?(String) && value_b.match?(/^\d+$/) sort_direction * (value_a <=> value_b) end %> <% end %> <% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], sort_menu: [ { item: "Year", link: "?sort=year_asc#table-sort", active: params["sort"] == "year_asc", direction: "asc" }, { item: "Year", link: "?sort=year_desc#table-sort", active: params["sort"] == "year_desc", direction: "desc" } ], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "sort", table_data: @table_data, column_definitions: column_definitions, id: "beta_sort" }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "sort", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "sort", table_data: @table_data, column_definitions: column_definitions, enable_toggle_expansion: "all" }) %> <% end %>
|
Year
|
New Enrollments
|
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
|
|
Year
|
New Enrollments
|
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 responsive prop can be set to "scroll" or "none", and is set to "scroll" by default to make Advanced Tables responsive. To disable, set responsive="none".
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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("title", props: { size: 4 }) do %> Not Responsive <% end %> <%= pb_rails("advanced_table", props: { id: "table_props_table_non_responsive", table_data: @table_data, column_definitions: column_definitions, responsive: "none" }) %> <%= pb_rails("title", props: { padding_top: "sm", size: 4 }) do %> Responsive as Default <% end %> <%= pb_rails("advanced_table", props: { id: "table_props_table_responsive", table_data: @table_data, column_definitions: column_definitions }) %>
|
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 }) %>
|
|
Enrollment Data
|
Performance Data
|
||||
|---|---|---|---|---|---|---|
|
Year
|
New Enrollments
|
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
|
Use a nested columns array in your columnDefinitions to create multiple header rows. Any column with columns is treated as a grouped header, and its child columns are displayed beneath it.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { label: "Enrollment Data", columns: [ { accessor: "newEnrollments", label: "New Enrollments", }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, { label: "Performance Data", columns: [ { 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: "beta_table_with_headers", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
Enrollment Data
|
Performance Data
|
||||
|---|---|---|---|---|---|---|
|
|
Enrollment Stats
|
Completion Metrics
|
Attendance
|
|||
|
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
|
Multiple levels of column headers can also be rendered as seen here.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { label: "Enrollment Data", columns: [ { label: "Enrollment Stats", columns: [ { accessor: "newEnrollments", label: "New Enrollments", }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, ], }, { label: "Performance Data", columns: [ { label: "Completion Metrics", columns: [ { accessor: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", label: "Class Completion Rate", }, ], }, { label: "Attendance", columns: [ { accessor: "attendanceRate", label: "Attendance Rate", }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, ], }, ] %> <%= pb_rails("advanced_table", props: { id: "beta_table_with_muilti_headers", table_data: @table_data, column_definitions: column_definitions }) %>
|
|
Enrollment Data
|
Performance Data
|
||||
|---|---|---|---|---|---|---|
|
Year
|
New Enrollments
|
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
|
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { label: "Enrollment Data", columns: [ { accessor: "newEnrollments", label: "New Enrollments", }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, { label: "Performance Data", columns: [ { 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: "table_multi_headers_vertical_borders", table_data: @table_data, column_definitions: column_definitions, table_props: { vertical_border: true } }) %>
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
|
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
|
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
|
|
2024
|
15
|
34
|
32%
|
6
|
67%
|
65
|
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "table-no-children", enable_toggle_expansion: "none", table_data: @table_data_no_subrows, column_definitions: column_definitions }) %>
|
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
|
|
Quarter
|
|
|
|
|
|
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
Month
|
|
|
|
|
|
|
|
January
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
Day
|
|
|
|
|
|
|
|
10
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
20
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
February
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
Day
|
|
|
|
|
|
|
|
15
|
19
|
35
|
69%
|
8
|
75%
|
23
|
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
|
|
Quarter
|
|
|
|
|
|
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
Month
|
|
|
|
|
|
|
|
January
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
Day
|
|
|
|
|
|
|
|
15
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
25
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
May
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
Day
|
|
|
|
|
|
|
|
2
|
19
|
35
|
69%
|
8
|
75%
|
23
|
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
|
|
Quarter
|
|
|
|
|
|
|
|
Q1
|
2
|
35
|
32%
|
15
|
52%
|
36
|
|
Month
|
|
|
|
|
|
|
|
March
|
16
|
20
|
11%
|
13
|
47%
|
28
|
|
Day
|
|
|
|
|
|
|
|
10
|
34
|
28
|
97%
|
20
|
15%
|
17
|
|
11
|
43
|
23
|
66%
|
26
|
47%
|
9
|
|
April
|
20
|
41
|
95%
|
26
|
83%
|
43
|
|
Day
|
|
|
|
|
|
|
|
15
|
19
|
35
|
69%
|
8
|
75%
|
23
|
selectable_rows is a boolean prop that if present will add checkboxes to all rows that will allow for selecting rows.
When a parent row is clicked, it will check all nested children rows, Children rows can be manually checked or unchecked as well.
The data attribute data-selected-rows on the parent pb_advanced_table div will update dynamically with each selection to show an array of ids corresponding to the current selection.
NOTE: Each object within the table_data Array must contain a unique id in order to attach an id to all Rows for this to function.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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", } ] subrow_headers = ["Quarter", "Month", "Day"] %> <%= pb_rails("advanced_table", props: { id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, selectable_rows: true }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "selectable_rows", column_definitions: column_definitions, selectable_rows: true }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "selectable_rows", table_data: @table_data_with_id, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all", selectable_rows: true }) %> <% end %>
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|
|---|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
| |
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
| |
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
| |
|
2024
|
15
|
34
|
32%
|
6
|
67%
|
65
|
selectable_rows can also be used with tables without nested row data. Set enable_toggle_expansion: none to adjust the Advanced Table styling to fit a table without subrows.
The data attribute data-selected-rows on the parent pb_advanced_table div will update dynamically with each selection to show an array of ids corresponding to the current selection.
NOTE: Each object within the table_data Array must contain a unique id in order to attach an id to all Rows for this to function.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "selectable_rows_no_subrows", table_data: @table_data_no_subrows, column_definitions: column_definitions, selectable_rows: true, enable_toggle_expansion: "none", }) %>
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|
|---|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
| |
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
| |
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
| |
|
2024
|
15
|
34
|
32%
|
6
|
67%
|
65
|
Custom actions content can be rendered within the Actions Bar as shown in this doc example. The component passed to actions will be rendered on the right of the actionsBar.
You can utilize script tags with your actions to provide your buttons with any clickable events needed.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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", } ] actions = [ pb_rails("circle_icon_button", props: { icon: "file-csv", variant: "link", id: "export-selected-rows-btn", data: { action_type: "export" } }), pb_rails("circle_icon_button", props: { icon: "trash-alt", variant: "link", id: "delete-selected-rows-btn", data: { action_type: "delete" } }) ] %> <%= pb_rails("advanced_table", props: { id: "selectable_rows_with_actions", table_data: @table_data_no_subrows, column_definitions: column_definitions, selectable_rows: true, enable_toggle_expansion: "none", actions: actions }) %> <script> // Handle action clicks using the data-selected-rows attribute window.handleActionClick = function(actionType) { const tableContainer = document.getElementById('selectable_rows_with_actions'); if (!tableContainer) return; // Get selected rows from the data attribute const selectedRowsJSON = tableContainer.getAttribute('data-selected-rows'); let selectedRowIds = []; try { // Parse the JSON string from the data attribute if (selectedRowsJSON) { selectedRowIds = JSON.parse(selectedRowsJSON); } } catch (e) { // Fallback if JSON parsing fails const checkboxes = tableContainer.querySelectorAll('input[type="checkbox"]:checked'); const selectedCheckboxes = Array.from(checkboxes).filter(checkbox => checkbox.id !== 'select-all-rows' && !checkbox.closest('#select-all-rows') ); selectedRowIds = selectedCheckboxes.map(checkbox => checkbox.id); } // Show appropriate message if (!selectedRowIds || selectedRowIds.length === 0) { alert('No Selection Made'); } else { const selectedRowsString = selectedRowIds.join(', '); if (actionType === 'export') { alert('Row ids ' + selectedRowsString + ' will be exported!'); } else if (actionType === 'delete') { alert('Row ids ' + selectedRowsString + ' will be deleted!'); } } }; // Add event listeners when the DOM is ready document.addEventListener('DOMContentLoaded', function() { // Get the buttons const exportBtn = document.getElementById('export-selected-rows-btn'); const deleteBtn = document.getElementById('delete-selected-rows-btn'); // Add click event listeners if (exportBtn) { exportBtn.addEventListener('click', function(e) { e.preventDefault(); window.handleActionClick('export'); }); } if (deleteBtn) { deleteBtn.addEventListener('click', function(e) { e.preventDefault(); window.handleActionClick('delete'); }); } // Optional: Event delegation through the action bar const actionBar = document.querySelector('.row-selection-actions-card'); if (actionBar) { actionBar.addEventListener('click', function(e) { const exportButton = e.target.closest('#export-selected-rows-btn'); const deleteButton = e.target.closest('#delete-selected-rows-btn'); if (exportButton) { e.preventDefault(); window.handleActionClick('export'); } else if (deleteButton) { e.preventDefault(); window.handleActionClick('delete'); } }); } }); </script>
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|
|---|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
| |
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
| |
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
| |
|
2024
|
15
|
34
|
32%
|
6
|
67%
|
65
|
show_actions_bar is an optional prop that renders the header at the top showing the row count. This is set to true by default but can be toggled off by setting it to false
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "selectable_rows_with_header_no_action_bar", table_data: @table_data_no_subrows, column_definitions: column_definitions, selectable_rows: true, enable_toggle_expansion: "none", show_actions_bar: false }) %>
|
Year
|
New Enrollments
|
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
|
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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: "beta_table", table_data: @table_data, column_definitions: column_definitions, max_height: "xs", scroll_bar_none: true }) %>
|
Year
|
New Enrollments
|
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 row_styling prop can be used in conjunction with row ids to control certain styling options on individual rows. It is an object that has several optional key/value pairs, this doc example highlights the following:
background_color : use this to control the background color of the rowfont_color: use this to control font color for each row if needed, for example if using a darker background color.expand_button_color: use this to control the color of the expand icon if needed, for example if using a darker background color.NOTE: Each object within the table_data Array must contain a unique id in order to attach an id to all Rows for this to function.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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", } ] %> <% row_styling = [ { row_id: "1", background_color: "#F9BB00", }, { row_id: "8", background_color: "#0056CF", font_color: "white", expand_button_color: "white", }, ] %> <%= pb_rails("advanced_table", props: { id: "row-styling", table_data: @table_data_with_id, column_definitions: column_definitions, row_styling: row_styling }) %>
|
Year
|
New Enrollments
|
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
|
row_styling can also be used to control padding on all cells in a given row via the use of the cell_padding key/value pair as shown here. cell_padding lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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", } ] %> <% row_styling = [ { row_id: "1", cell_padding: "md" }, { row_id: "3", cell_padding: "lg" }, { row_id: "5", cell_padding: "none" }, ] %> <%= pb_rails("advanced_table", props: { id: "padding-control-per-row", table_data: @table_data_with_id, column_definitions: column_definitions, row_styling: row_styling }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "padding-control-per-row", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "padding-control-per-row", table_data: @table_data_with_id, column_definitions: column_definitions, row_styling: row_styling }) %> <% end %>
|
Year
|
New Enrollments
|
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 column_styling prop is an optional item that can be used within column_definitions as shown in the code snippet below. It is an object that has several optional key/value pairs, this doc example highlights the following:
1) header_alignment: This will allow you to control alignment of header content which is set to right aligned by default. you can set this to left, right or center.
2) cell_alignment: This will allow you to control alignment of content within all cells in the given column. This is set to right aligned by default. you can set this to left, right or center.
3) font_color: This will allow you to control the font color for a given column.
column_styling can be used within the column_definition of all the columns or some of them, as shown. Each column has its own individual control in this way.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", column_styling:{header_alignment:"left", cell_alignment:"left"} }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", column_styling:{header_alignment:"center", cell_alignment:"center"} }, { accessor: "attendanceRate", label: "Attendance Rate", }, { accessor: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", label: "Class Completion Rate", }, { accessor: "graduatedStudents", label: "Graduated Students", column_styling: { font_color: "red" } } ] %> <%= pb_rails("advanced_table", props: { id: "column-styling", table_data: @table_data, column_definitions: column_definitions }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "column-styling", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "column-styling", table_data: @table_data, column_definitions: column_definitions }) %> <% end %>
|
|
Enrollment Data
|
Performance Data
|
||||
|---|---|---|---|---|---|---|
|
|
Enrollment Stats
|
Completion Metrics
|
Attendance
|
|||
|
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
|
column_styling can also be used with the multi column logic. When used in this way, column_styling must be used within the leaf column's column_definition as shown.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { label: "Enrollment Data", columns: [ { label: "Enrollment Stats", columns: [ { accessor: "newEnrollments", label: "New Enrollments", column_styling:{header_alignment:"left", cell_alignment:"left"} }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, ], }, { label: "Performance Data", columns: [ { label: "Completion Metrics", columns: [ { accessor: "completedClasses", label: "Completed Classes", column_styling:{header_alignment:"center", cell_alignment:"center"} }, { accessor: "classCompletionRate", label: "Class Completion Rate", }, ], }, { label: "Attendance", columns: [ { accessor: "attendanceRate", label: "Attendance Rate", }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, ], }, ] %> <%= pb_rails("advanced_table", props: { id: "column-styling-multi", table_data: @table_data, column_definitions: column_definitions }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "column-styling-multi", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "column-styling-multi", table_data: @table_data, column_definitions: column_definitions }) %> <% end %>
|
Year
|
New Enrollments
|
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
|
column_styling can also be used to control padding on all cells in a given column via the use of the cell_padding key/value pair. cell_padding lets you use 'xxs', 'xs', 'sm', 'md', 'lg', 'xl' and 'none'.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", column_styling: { cell_padding: "none", } }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, { accessor: "attendanceRate", label: "Attendance Rate", column_styling: { cell_padding: "md" }, }, { accessor: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", label: "Class Completion Rate", }, { accessor: "graduatedStudents", label: "Graduated Students", } ] %> <%= pb_rails("advanced_table", props: { id: "padding-control", table_data: @table_data, column_definitions: column_definitions }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "padding-control", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "padding-control", table_data: @table_data, column_definitions: column_definitions }) %> <% end %>
|
Year
|
New Enrollments
|
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
|
column_styling can also be used to control the background color on all cells in a given column. Use the following key/values pairs to achieve this:
1) cell_background_color: use this to control the background color of all cells in the given column
2) font_color: use this to control font color for all cells in the given column if needed, for example if using a darker background color
3) header_background_color: use this to control the background color of the column header
4) header_font_color: use this to control font color for the header in the given column if needed, for example if using a darker background color.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", column_styling: { cell_background_color: "error_subtle", header_background_color: "error_subtle" } }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", column_styling: { cell_background_color: "info_subtle", } }, { accessor: "attendanceRate", label: "Attendance Rate", column_styling: { cell_background_color: "info", header_background_color: "info", header_font_color: "white", font_color: "white" } }, { accessor: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", label: "Class Completion Rate", }, { accessor: "graduatedStudents", label: "Graduated Students", } ] %> <%= pb_rails("advanced_table", props: { id: "background-control", table_data: @table_data, column_definitions: column_definitions }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "background-control", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "background-control", table_data: @table_data, column_definitions: column_definitions }) %> <% end %>
|
Year
|
New Enrollments
|
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
|
column_styling can also be used to control the background color on individual cells in a given column as shown here.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", column_styling: { cell_background_color: ->(row) { row[:newEnrollments].to_i > 20 ? "success_secondary" : "warning_secondary" } } }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, { accessor: "attendanceRate", label: "Attendance Rate", }, { accessor: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", label: "Class Completion Rate", column_styling: { cell_background_color: "category_1", font_color: "white" } }, { accessor: "graduatedStudents", label: "Graduated Students", } ] %> <%= pb_rails("advanced_table", props: { id: "background-control", table_data: @table_data, column_definitions: column_definitions }) do %> <%= pb_rails("advanced_table/table_header", props: { table_id: "background-control", column_definitions: column_definitions }) %> <%= pb_rails("advanced_table/table_body", props: { table_id: "background-control", table_data: @table_data, column_definitions: column_definitions }) %> <% end %>
|
|
Enrollment Data
|
Performance Data
|
||||
|---|---|---|---|---|---|---|
|
|
Enrollment Stats
|
Completion Metrics
|
Attendance
|
|||
|
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 borders of column groups can be set to a different color using the column_group_border_color prop. In order for these borders to be visible, this prop must be used with table_props and vertical_border set to true.
The available colors for the border are Playbook's Text Colors, which can be found here.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { label: "Enrollment Data", columns: [ { label: "Enrollment Stats", columns: [ { accessor: "newEnrollments", label: "New Enrollments", }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, ], }, { label: "Performance Data", columns: [ { label: "Completion Metrics", columns: [ { accessor: "completedClasses", label: "Completed Classes", }, { accessor: "classCompletionRate", label: "Class Completion Rate", }, ], }, { label: "Attendance", columns: [ { accessor: "attendanceRate", label: "Attendance Rate", }, { accessor: "scheduledMeetings", label: "Scheduled Meetings", }, ], }, ], }, ] %> <%= pb_rails("advanced_table", props: { id: "beta_table_with_color_headers", table_data: @table_data, column_definitions: column_definitions, column_group_border_color: "text_lt_default", table_props: { vertical_border: true } }) %>
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
|
Loading
| ||||||
|
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
|
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
|
Loading
| ||||||
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
|
Loading
| ||||||
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
|
Loading
| ||||||
|
Year
|
New Enrollments
|
Scheduled Meetings
|
Attendance Rate
|
Completed Classes
|
Class Completion Rate
|
Graduated Students
|
|---|---|---|---|---|---|---|
|
2021
|
20
|
10
|
51%
|
3
|
33%
|
19
|
Loading
| ||||||
|
2022
|
25
|
17
|
75%
|
5
|
45%
|
32
|
Loading
| ||||||
|
2023
|
10
|
15
|
65%
|
4
|
49%
|
29
|
Loading
| ||||||
By default, the kit assumes that the initial dataset is complete, rendering expansion controls only when children are present. If, however, you want to implement lazy-loading patterns where children are fetched only when a parent is expanded, use the inline_row_loading prop.
When inline_row_loading is set to true:
children arrays (you must pass children: [] to any row that will have children loaded later)In the first table above, row "2021" has an empty children array. Click to expand it and see the inline loading state. Rows 2 and 3 have actual child data.
This prop is set to false by default.
The persist_toggle_expansion_button is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty children arrays and advanced querying logic explained in the preceding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
In the second and third Advanced Tables in this code example, all 3 rows have empty children arrays. The second Advanced Table demonstrates that the toggle all button does not render (prior to an initial row expansion) without persist_toggle_expansion_button in place. The third Advanced Table shows the toggle all button due to persist_toggle_expansion_button.
This prop is set to false by default and should only be used in conjunction with inline_row_loading.
<% column_definitions = [ { accessor: "year", label: "Year", cellAccessors: ["quarter", "month", "day"], }, { accessor: "newEnrollments", label: "New Enrollments", }, { 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("caption", props: { text: "Inline Row Loading - Demonstrated in Row 1 (Rows 2 and 3 have data)" }) %> <%= pb_rails("advanced_table", props: { id: "inline-loading-table-1", table_data: @table_data_inline_loading, column_definitions: column_definitions, enable_toggle_expansion: "all", inline_row_loading: true, margin_bottom: "md" }) %> <%= pb_rails("caption", props: { text: "Inline Row Loading with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is not rendered" }) %> <%= pb_rails("advanced_table", props: { id: "inline-loading-table-2", table_data: @table_data_inline_loading_empty_children, column_definitions: column_definitions, enable_toggle_expansion: "all", inline_row_loading: true, margin_bottom: "md" }) %> <%= pb_rails("caption", props: { text: "Inline Row Loading and Persist Toggle Expansion Button with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is rendered" }) %> <%= pb_rails("advanced_table", props: { id: "inline-loading-table-3", table_data: @table_data_inline_loading_empty_children, column_definitions: column_definitions, enable_toggle_expansion: "all", inline_row_loading: true, persist_toggle_expansion_button: true }) %>