I am following the linked example to create my own sortFunction for the DataTable:
https://github.com/primefaces/primereact/issues/348
My sortFunction is working, but I could not figure out how to import ObjectUtils from the PrimeReact library in my React application. I ended up copying and pasting the resolveFieldData and isFunction functions from ObjectUtils.js into my file as a workaround.
In the sample I see : import ObjectUtils from '../../components/utils/ObjectUtils';
I have tried :
import ObjectUtils from 'primereact/utils/Utils';
import {ObjectUtils} from 'primereact/utils/Utils'
import ObjectUtils from 'primereact/utils/ObjectUtils'
all with no luck. Is there a way to import this class into my React component?
Thanks
How to import ObjectUtils
Could you try
Code: Select all
import ObjectUtils from 'primereact/components/utils/ObjectUtils';
-
- Posts: 5281
- Joined: 29 Jun 2013, 12:38
Hi,
Which version are you using?
Which version are you using?
Github Profile: https://github.com/mertsincan
-
- Posts: 1
- Joined: 01 Apr 2020, 18:17
Code: Select all
// to import ObjectUtils
import { ObjectUtils } from 'primeng/utils'
// to use a function from it
class SomeComponent {
someMethod() {
const value1 = ObjectUtils.resolveFieldData(data1, field)
}
}
Mert, I am having this same issue with 7.0.1. I can't get to ObjectUtils...
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
i think this issue will fix it: https://github.com/primefaces/primereact/issues/2462
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
This is fixed in 7.1.0
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1
-
- Information
-
Who is online
Users browsing this forum: No registered users and 8 guests