aus Iflight soll jetzt CFlightProxy werden

This commit is contained in:
2022-12-05 23:09:56 +01:00
parent dfaa6f6c4c
commit 9c3cae8350
5 changed files with 68 additions and 31 deletions

View File

@ -21,8 +21,8 @@ function Meter2Km(key: string, row: any, data: string | null)
return val;
}
export default function FlightsTable(flightdata: IFlight[])
//export default function FlightsTable(flightdata: any)
//export default function FlightsTable(flightdata: IFlight[])
export default function FlightsTable(flightdata: any)
{
const headers: THeader[] = [
{ key: "IDFlight", label: "ID", visible: false },

View File

@ -65,12 +65,12 @@ export default function SortableTable<T>({ headers, dataTbl }:
if (!sortKey) return tableData;
const order = reverse ? 'asc': 'desc';
// const reval: T[] = orderBy(tableData, [sortKey], [order]);
const reval: T[] = tableData;
//const reval: any = orderBy(tableData, [sortKey], [order]);
const reval: any[] = tableData;
return reval;
}
function TableTd({ item, row_item, data } : {item: THeader, row_item: T, data: string | null})
function TableTd({ item, key, row_item, data } : {item: THeader, key: number, row_item: T, data: string | null})
{
var val_complete: JSX.Element = <></>;
if(item.visible === undefined || item.visible === true)
@ -81,31 +81,58 @@ export default function SortableTable<T>({ headers, dataTbl }:
}
else
{
val_complete = (<td>{data}</td>);
val_complete = (<td key={key}>{data}</td>);
}
}
return val_complete;
}
function TableTr(
{headers,row_item}:
{headers, key, row_item}:
{
headers: THeader[],
key: number,
row_item: T
})
{
return(
<tr>
<tr key={key}>
{
headers.map((h_item) =>
headers.map((h_item, key) =>
{
var c: any = row_item; // workaround TS2322 TS7053
return ( <TableTd item={h_item} row_item={row_item} data={c[h_item.key]}></TableTd> );
return ( <TableTd item={h_item} key={key} row_item={row_item} data={c[h_item.key]}></TableTd> );
})}
</tr>
);
}
function dummy()
{
var val_complete: JSX.Element = <></>;
var a = 2+2;
return val_complete;
}
function tableBody(headers: THeader[], tableDataSorted : T[])
{
var body: JSX.Element[] = [];
const helpArr = tableDataSorted.toArray();
for(var flight of tableDataSorted)
{
var index: number = tableDataSorted.indexOf(flight);
body.push(
<TableTr headers={headers} key={index} row_item = {flight} />
);
}
return(
<tbody>
{body}
</tbody>
);
}
function tableHeader(headers: THeader[])
{
@ -144,14 +171,9 @@ export default function SortableTable<T>({ headers, dataTbl }:
{tableHeader(headers)}
</tr>
</thead>
<tbody>
{sortedData.map((row_item) => {
return (
<TableTr headers={headers} row_item = {row_item} />
);
})}
</tbody>
{
tableBody( headers, sortedData )
}
</table>
);
}