Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Export Collection Not Respecting Filters. #1650

Unanswered
yashRechargezap asked this question in Q&A
Discussion options

In my Admin Panel I want to export csv. It is working fine, But when I apply filter on the collection it is still exporting the complete collection.
here is the code how am I defining the ImportExport feature.

export const AdminOperatorsResource = {
 resource: AdminOperators,
 features: [importExportFeature({ componentLoader })],
 options: {
 navigation: Navigation.adminNavigation,
 properties: {
 accessToken: {
 isVisible: {
 edit: false,
 show: false,
 },
 },
 createdBy: {
 isVisible: {
 edit: false,
 show: true,
 new: false,
 },
 },
 createdAt: {
 isVisible: {
 edit: false,
 show: true,
 new: false,
 },
 },
 updatedBy: {
 isVisible: {
 edit: false,
 show: true,
 new: false,
 },
 },
 updatedAt: {
 isVisible: {
 edit: false,
 show: true,
 new: false,
 },
 },
 },
 actions: {
 new: {
 before: async (request, context) => {
 let count = (
 await Counters.findOne({
 _id: 'AdminOperators',
 })
 ).sequence_value;
 count = count + 1;
 console.log(count);
 const modifiedPayload = {
 ...request.payload,
 _id: count,
 createdBy: context.currentAdmin.id,
 createdAt: new Date().toISOString(),
 };
 await Counters.findOneAndUpdate(
 {
 _id: 'AdminOperators',
 },
 { sequence_value: count },
 );
 return {
 ...request,
 payload: modifiedPayload,
 };
 },
 },
 edit: {
 before: async (request, context) => {
 const modifiedPayload = {
 ...request.payload,
 updatedBy: context.currentAdmin.id,
 updatedAt: new Date().toISOString(),
 };
 return {
 ...request,
 payload: modifiedPayload,
 };
 },
 },
 BulkUpload: {
 actionType: 'resource',
 variant: 'success',
 icon: 'File',
 component: Components.BulkUpload,
 handler: async (request, response, context) => {
 const { record, currentAdmin } = context;
 console.log(' Hi Dummy button was clicked!');
 return {
 record: await record.toJSON(currentAdmin),
 msg: 'Hello world',
 };
 },
 },
 },
 },
};```
Also How can I disable the Import button, as I only want the export feature.
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /