feat: custom style list virtual on parent text field not on dialog
This commit is contained in:
parent
a6371b64fa
commit
4e0c6e12f4
@ -35,7 +35,8 @@ export default function ListVirtual({
|
||||
helperText,
|
||||
filter,
|
||||
isApiGo = false,
|
||||
multiple
|
||||
multiple,
|
||||
customSxTextField = {}
|
||||
}) {
|
||||
const headersRequest = useApiHeaders();
|
||||
const [open, setOpen] = useState(false);
|
||||
@ -82,8 +83,6 @@ export default function ListVirtual({
|
||||
);
|
||||
const incomingData = res.data || [];
|
||||
|
||||
console.log("res", res)
|
||||
|
||||
setRows(prev => isAppend ? [...prev, ...incomingData] : incomingData);
|
||||
setTotalRecord(res.totalRecord || 0);
|
||||
setOffset(currentOffset);
|
||||
@ -97,22 +96,11 @@ export default function ListVirtual({
|
||||
const handleScroll = (e) => {
|
||||
const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
|
||||
|
||||
console.log({
|
||||
scrollTop,
|
||||
scrollHeight,
|
||||
clientHeight,
|
||||
rows: rows.length,
|
||||
totalRecord,
|
||||
loading,
|
||||
});
|
||||
|
||||
const isAtBottom = scrollHeight - scrollTop <= clientHeight + 20;
|
||||
|
||||
if (isAtBottom && !loading && rows.length < totalRecord) {
|
||||
const nextOffset = offset + lengthData;
|
||||
|
||||
console.log("LOAD MORE", nextOffset);
|
||||
|
||||
fetchData(search, nextOffset, true);
|
||||
}
|
||||
};
|
||||
@ -241,6 +229,7 @@ export default function ListVirtual({
|
||||
error={!!error}
|
||||
onClick={() => !disabled && setOpen(true)}
|
||||
sx={{
|
||||
...customSxTextField,
|
||||
'& .MuiOutlinedInput-root.Mui-error .MuiOutlinedInput-notchedOutline': {
|
||||
borderColor: 'error.main',
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
export const formatApiResponse = (responseOrError) => {
|
||||
if (responseOrError?.status) {
|
||||
const { status, data, message } = responseOrError;
|
||||
console.log("status", responseOrError.status)
|
||||
|
||||
if (status >= 200 && status < 300) {
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user