Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add key support and pagination to TableView #25

Open
TheErondu opened this issue Apr 9, 2023 · 1 comment
Open

add key support and pagination to TableView #25

TheErondu opened this issue Apr 9, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@TheErondu
Copy link

Please i get this error when trying to load table with data from api... the table renders successfully but i get error on console :

act_devtools_backend.js:2655 Warning: Encountered two children with the same key, `9`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.

see attached screen shot

here's my code:

import React, { useEffect, useState } from "react";
import { LoaderBusy, NavPageContainer, TableView } from "react-windows-ui";
import ApiEndpoints from "../../utils/api-endpoints";
import ApiService from "../../services/api-service";

const Users = () => {
 const [usersList, setUsersList] = useState([]);
 const [isLoading, setIsLoading] = useState(true);

 useEffect(() => {
   // Call the API service to get the message
   ApiService.apiCall({ endpoint: ApiEndpoints.getUsers, secured: true }).then((response) => {
     if (response.success) {
       setUsersList(response.data.data);
     }
     setIsLoading(false);
   });
 }, []);

 if (isLoading) {
   return <NavPageContainer hasPadding={true} animateTransition={true}>
     <div className="centered">
       <LoaderBusy isLoading={true} />
     </div>
   </NavPageContainer>
 }
 else {
   return (
     <NavPageContainer hasPadding={true} animateTransition={true}>
       <h1>Users</h1>
       <TableView
         columns={Object.keys(usersList[0]).map((key) => ({
           title: key,
           showSortIcon: true,
           sortable: true,
         }))}
         rows={usersList.map((user) => Object.values(user))}
       />
     </NavPageContainer>
   );
 }
};

export default Users;

Screen Shot 2023-04-09 at 10 56 10 PM

@virtualvivek
Copy link
Owner

Hi @TheErondu,

Thanks for informing about this issue regarding the ListView.
This will be fixed in the next release with few more improvements :)

@virtualvivek virtualvivek added the bug Something isn't working label Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants