Sha256: 0ba2e1965e3f190a5dc2e5a50198b43881af80f55bb675386667613ea32cc789
Contents?: true
Size: 1.35 KB
Versions: 98
Compression:
Stored size: 1.35 KB
Contents
import React, { useState } from "react"; import { AdvancedTable } from "../.."; import { MOCK_DATA } from "./_mock_data"; 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
98 entries across 98 versions & 2 rubygems