Sha256: ea3934dac50bb4dff124ed8673d830bbe415761eafddc6492471e6c90cd41906
Contents?: true
Size: 1.36 KB
Versions: 132
Compression:
Stored size: 1.36 KB
Contents
import React, { useState } from "react" import { AdvancedTable } from "../.." import MOCK_DATA from "./advanced_table_mock_data.json" const AdvancedTableSortControl = (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 sort direction const [isSortDesc, setIsSortDesc] = useState({desc: false}) // //Passing sort state to AdvancedTable as prop const sortControl = { value: isSortDesc, onChange: setIsSortDesc, } return ( <div> <AdvancedTable columnDefinitions={columnDefinitions} sortControl={sortControl} tableData={MOCK_DATA} {...props} > <AdvancedTable.Header enableSorting /> <AdvancedTable.Body /> </AdvancedTable> </div> ) } export default AdvancedTableSortControl
Version data entries
132 entries across 132 versions & 2 rubygems