Consider case where my filterList is [1, 0, 2].
In update function of customFilterListOptions I should get index of removed value. When I remove chip with value 0 (index=1 in provided case), the filterPos should be 1.
Current Behavior
It works properly in almost all casses, but when removed chip/value is 0, filterPos is -1.
Expected Behavior
Consider case where my
filterList
is [1, 0, 2]. Inupdate
function ofcustomFilterListOptions
I should get index of removed value. When I remove chip with value 0 (index=1 in provided case), thefilterPos
should be 1.Current Behavior
It works properly in almost all casses, but when removed chip/value is 0,
filterPos
is -1.Steps to Reproduce (for bugs)
codesandbox: https://codesandbox.io/s/custom-filter-chip-issue-3qtm2x?file=/src/index.tsx
step to reproduce:
User
chipAdmin
is removed instead.Your Environment
Additional Info
I found that this issue may be caused by this line https://github.com/gregnb/mui-datatables/blob/a382f3e8e850c7fcdd395f8594a5e0afefcaf905/src/components/TableFilterList.js#L63
item[customFilterItemIndex]
of value 0 is consider as false and then[]
is passed.Then here https://github.com/gregnb/mui-datatables/blob/a382f3e8e850c7fcdd395f8594a5e0afefcaf905/src/MUIDataTable.js#L1372 value could not be found and -1 is returned;