sorting list creation draft done

This commit is contained in:
2026-04-03 11:43:17 +10:00
parent 4a6659f26e
commit a316762ad3
3 changed files with 80 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import { useState } from "react";
import TableHead from './TableHead.jsx';
import TableBody from './TableBody.jsx';
import Filter from './Filter.jsx';
import Sorting from './Sorting.jsx';
/*
компонент, выводящий на страницу таблицу с пагинацией
@@ -27,7 +28,7 @@ const Table = (props) => {
//формируем совокупность span с номерами страниц
const pages = arr.map((item, index) =>
<span className={index == (activePage - 1) ? "selected" : ""} key={index} onClick={changeActive}> {item} </span>
<span key={index} className={index == (activePage - 1) ? "selected" : ""} onClick={changeActive}> {item} </span>
);
return (
@@ -35,6 +36,10 @@ const Table = (props) => {
<h4>Filters</h4>
<Filter filtering={updateDataTable} data={dataTable} fullData={props.data} />
<h4>Sort by</h4>
<Sorting data = {dataTable} keys = {Object.keys(props.data[0])}/>
<table>
<TableHead head={Object.keys(props.data[0])} />
<TableBody body={dataTable} amountRows={props.amountRows} numPage={activePage} />