Sha256: 8323b02cba3285a7eb4ef14d4d74fad6adc1cfeb5ca3790fb04fb8a398c916aa

Contents?: true

Size: 1.47 KB

Versions: 132

Compression:

Stored size: 1.47 KB

Contents

import React, { useState } from "react"
import { AdvancedTable } from "../../"
import MOCK_DATA from "./advanced_table_mock_data.json"

const AdvancedTableExpandedControl = (props) => {
  const columnDefinitions = [
    {
      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",
    },
  ]

  //State for manually effecting what is expanded
  const [expanded, setExpanded] = useState({'0': true, '0.0': true, '0.0.1': true})

  //Passing expanded state to AdvancedTable as prop
  const expandedControl = {
    value: expanded,
    onChange: setExpanded,
  }

  const onRowToggleClick = (row) => {
    setExpanded({ ...expanded, [row.id]: !expanded[row.id] })
  }

  return (
    <div>
      <AdvancedTable
          columnDefinitions={columnDefinitions}
          expandedControl={expandedControl}
          onRowToggleClick={onRowToggleClick}
          tableData={MOCK_DATA}
          {...props}
      />
    </div>
  )
}

export default AdvancedTableExpandedControl

Version data entries

132 entries across 132 versions & 2 rubygems

Version Path
playbook_ui_docs-13.30.0.pre.alpha.PBNTR353draggablev53136 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.30.0.pre.alpha.PBNTR353draggablev53136 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui_docs-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.30.0 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui_docs-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui_docs-13.29.0.pre.alpha.PBNTR329draggablev33060 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33060 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui_docs-13.29.0.pre.alpha.PBNTR329draggablev33059 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33059 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui_docs-13.29.0.pre.alpha.testingcollapsibleissue3052 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.29.0.pre.alpha.testingcollapsibleissue3052 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.29.0 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui_docs-13.28.0.pre.alpha.PBNTR297gradientoverlay3029 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.28.0.pre.alpha.PBNTR297gradientoverlay3029 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui_docs-13.28.0.pre.alpha.pbntr312tableheaderflexremoval3019 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.28.0.pre.alpha.pbntr312tableheaderflexremoval3019 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui_docs-13.28.0.pre.alpha.dialogturbostreameventlistener3017 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx
playbook_ui-13.28.0.pre.alpha.dialogturbostreameventlistener3017 app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx