Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PBNTR-740] Advanced Table - Add Table Props to Rails kit #4107

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= pb_content_tag do %>
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }) do %>
<%= pb_rails("table", props: { size: "sm", data_table: true, number_spacing:"tabular", responsive:"none", dark: dark }.merge(object.table_props)) do %>
<% if content.present? %>
<% content.presence %>
<% else %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class AdvancedTable < Playbook::KitBase
prop :responsive, type: Playbook::Props::Enum,
values: %w[none scroll],
default: "none"
prop :table_props, type: Playbook::Props::HashProp,
default: {}

def classname
generate_classname("pb_advanced_table", responsive_classname, separator: " ")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<% 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: { container: false, sticky: true }}) %>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This kit uses the [Table kit](https://playbook.powerapp.cloud/kits/table) under the hood which comes with it's 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](https://playbook.powerapp.cloud/kits/table).
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ examples:
- advanced_table_beta: Default (Required Props)
- advanced_table_beta_subrow_headers: SubRow Headers
- advanced_table_collapsible_trail_rails: Collapsible Trail
- advanced_table_table_props: Table Props
- advanced_table_beta_sort: Enable Sorting
- advanced_table_custom_cell_rails: Custom Components for Cells
- advanced_table_column_headers: Multi-Header Columns
Expand Down
Loading