Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

91
Views
Filter options material-ui autocomplete

I'm using ReactJs, Material-UI autocomplete with 20000 options for select. Each option represented as object with portfolio, country and assetType.

 const options = [{portfolio: 'test_index', country: 'Austria', assetType: 'index'},
 { portfolio: 'Italy $1M Turnover StdTurn btm 10 Middle of Quarter LCL', country: 'Italy', assetType: 'portfolio'},
 { portfolio: 'Israel $1M Turnover StdTurn top 20 Middle of Quarter LCL', country: 'Italy', assetType: 'portfolio'},
 { portfolio: 'United States $1M Turnover ROE top 20 Middle of Quarter LCL', country: 'Italy', assetType: 'portfolio'}] 

I need to filter options by 'portfolio'. Filter should work like contain. Such that if type Italy Middle or Middle Italy i get this responce 'Italy $1M Turnover StdTurn btm 10 Middle of Quarter LCL'

Material-ui recommend several options : createFilterOptions and match-sorter

  • match-sorter work very slow with a huge amount of data. Also if you change order of the words like Middle Italy search does not work.
  • createFilterOptions does not work like contain. Autocomplete looks like following:

    <Autocomplete
      filterOptions={filterOptions}
      size="small"
      id="assets_async_autocmplete"
      className={classes.root}
      disableListWrap
      sx={{ width: 365 }}
      open={open}
      PopperComponent={StyledPopper}
      ListboxComponent={ListboxComponent}
      onOpen={() => {
        setOpen(true);
      }}
      onClose={() => {
        setOpen(false);
      }}
      isOptionEqualToValue={(option, value) => option === value}
      getOptionLabel={(option) => option.portfolio}
      options={options}
      loading={loading}
      renderOption={(props, option) => (
        <Stack
          key={option.portfolio}
          justifyContent="center"
        >
          <SearchRowContainer saveAssetId={saveAssetId} props={props} favorites={favorites} option={option} />
          <hr className={style.delimeter} />
        </Stack>
      )}
      renderInput={(params) => (
        <RenderInput params={params} loading={loading} />
      )}
      popupIcon={<GlassIcon />}
    />

Can anybody suggest efficient way\library to filter the options. Thanks in advance

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!