Comments (1)
To add the 'create new entry' functionality to the 'from many' relation pickers, follow these steps:
- Import necessary hooks and components in
/packages/twenty-front/src/modules/object-record/relation-picker/components/MultipleObjectRecordSelect.tsx
:
import { useAddNewRecordAndOpenRightDrawer } from '@/object-record/relation-picker/hooks/useAddNewRecordAndOpenRightDrawer';
import { IconForbid } from 'twenty-ui';
- Initialize the hooks within the
MultipleObjectRecordSelect
component:
const { createNewRecordAndOpenRightDrawer } = useAddNewRecordAndOpenRightDrawer({
relationObjectMetadataNameSingular: fieldDefinition.metadata.relationObjectMetadataNameSingular,
relationObjectMetadataItem,
relationFieldMetadataItem,
entityId,
});
- Add the 'create new entry' button to the component's return statement:
<SingleEntitySelect
EmptyIcon={IconForbid}
emptyLabel={'No ' + fieldDefinition.label}
onCancel={onCancel}
onCreate={createNewRecordAndOpenRightDrawer}
onEntitySelected={handleEntitySelected}
width={width}
relationObjectNameSingular={fieldDefinition.metadata.relationObjectMetadataNameSingular}
relationPickerScopeId={relationPickerScopeId}
selectedRelationRecordIds={recordId ? [recordId] : []}
excludedRelationRecordIds={excludeRecordIds}
/>
This will enable the 'create new entry' functionality in the 'from many' relation pickers similar to the 'to one' relation pickers.
References
/packages/twenty-front/src/modules/object-record/relation-picker/components/RelationPicker.tsx
/packages/twenty-front/src/modules/object-record/relation-picker/components/MultipleObjectRecordSelect.tsx
/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useAddNewRecordAndOpenRightDrawer.ts
/packages/twenty-front/src/modules/object-record/relation-picker/hooks/useRelationPicker.ts
/packages/twenty-front/src/modules/object-record/relation-picker/components
/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/RelationManyFieldInput.tsx
About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a ๐ if this is helpful and ๐ if it is irrelevant.
from twenty.
Related Issues (20)
- Number of records design on kanban HOT 4
- Adjust empty tag style HOT 4
- feat: add eslint rule for enforcing WorkspaceService naming convention HOT 1
- Need Setup section in Readme.md HOT 4
- In opportunities kanban don't show company picker if company field is disabled HOT 1
- Allow renaming names from uploaded files HOT 7
- Allow creating folders for file-management HOT 1
- make postgres-on-linux uses sudo unexpectedly
- Record Page Navigation Arrows Cause Unnecessary skeleton loading HOT 2
- Twenty:front won't start from local (WSL) setup and lots of yarn warning + DB problem HOT 1
- Pass SELECT filter values upon new record creation
- Replace entityId by recordId in the front end. HOT 4
- Refactor RecordInlineCell tree with a Context to avoid props drilling HOT 1
- Upgrade guide - missing upgrade guide for versions previous to 0.21.0 HOT 1
- Refactor RecordInlineCellEditMode
- Setup Script / Docker Compose: Custom port does not work, attempting to access graphql on port 3000 still HOT 4
- Handle cursor filter in optimistic rendering
- Profile switch view from board view to see why it's slow.
- Order by currency bug with cursor
- New View creation loading is too long HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twenty.