Commit 293041a0 authored by Henrique Varella Ehrenfried's avatar Henrique Varella Ehrenfried
Browse files

Add UF filter using map


Signed-off-by: Henrique Varella Ehrenfried's avatarHenrique V. Ehrenfried <hvehrenfried@inf.ufpr.br>
parent e480496c
......@@ -5,10 +5,13 @@ import * as d3 from 'd3';
function CsvTable(props){
const [ csvData, setCsvData ] = useState([])
const [ csvTable, setTable ] = useState([])
const [ columns, setColumns] = useState(props.columns)
const [ pageSize, setPageSize] = useState(props.pageSize)
const [ mouseCursor, setMouseCursor] = useState(props.mouseCursor)
const [ filterable, setFilterable] = useState(props.filterablelse)
const [ filterable, setFilterable] = useState(props.filterable)
const [ uf, setUF] = useState(props.uf)
var len = 0
useEffect(() => {
......@@ -17,10 +20,34 @@ function CsvTable(props){
len = read_csv.length
if (len > 0) {
setCsvData(read_csv)
setTable(read_csv)
}
});
},[columns]);
useEffect(() => {
var newUF = props.uf
if (newUF != uf){
setUF(newUF)
updateTable(newUF)
}
});
const updateTable = ((uf) =>{
let aux =[]
let len = csvTable.length
if (uf != ""){
for (let i = 0; i < len; i = i + 1){
if (csvTable[i]["UF"] == uf){
aux.push(csvTable[i])
}
}
setCsvData(aux)
} else {
setCsvData(csvTable)
}
})
return(
<PageTable
columns={columns}
......
......@@ -26,7 +26,7 @@ import CardFooter from '../Components/CardFooter';
import UfBar from '../Components/UfBar';
import GrayBar from '../Components/GrayBar';
import MapMarker from './icons/map-marker.png';
import { getStateExtendedName } from '../enviroment';
import { getStateExtendedName, getStateAcronym } from '../enviroment';
import * as data from '../JsonsAntigos/brasil-quilombola/bqe1'
// import BuildLineNotFixed from '../Charts/BuildLineNotFixed'
import BuildPie from '../Charts/BuildPie'
......@@ -430,6 +430,7 @@ class Eixo1 extends Component {
// sortMethod={this.communitiesSort}
mouseCursor='pointer'
filterable = {true}
uf={getStateAcronym(this.state.clickedInMap)}
/>
{/* carregando dados na hora errada faz a tabela ficar nula, descobrir como evitar isso */}
<CardFooter
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment