Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared module gridOptions seetings not preserve in page module #1329

Closed
5 tasks done
lajith111 opened this issue Dec 15, 2023 · 15 comments
Closed
5 tasks done

Shared module gridOptions seetings not preserve in page module #1329

lajith111 opened this issue Dec 15, 2023 · 15 comments

Comments

@lajith111
Copy link

lajith111 commented Dec 15, 2023

Describe the bug

I have defined grid options in shared modules

 AngularSlickgridModule.forRoot({
      externalResources: [new ExcelExportService()],   
      enableAutoResize: true,
      enableGridMenu: true,
      enableExcelExport:true,
      autoHeight: true,
      alwaysShowVerticalScroll: true,
}

In page component also some configuration defined

 this.gridOptions = {
      // enableExcelExport: true,  
      // externalResources: [new ExcelExportService()],    //now this needs to defined in each page after update new version
      excelExportOptions:{
        sanitizeDataExport: true,
         filename:'BankReport_'+ new Date().toJSON().slice(0,10),
         exportWithFormatter:true,
       },

other wise i am getting below error.

[Slickgrid-Universal] You must register the ExcelExportService to properly use Export to Excel in the Grid Menu. Example:: this.gridOptions = { enableExcelExport: true, externalResources: [new ExcelExportService()] };
executeGridMenuInternalCustomCommands @ slickGridMenu.js:651

After i upgrade to 7.x i am getting this error

if i include externalResources in each component excel download. Thanks for the update

i dont no this is a issue. But i found this in my testing ..

Reproduction

After upgrading to v 7 i found this issue

Expectation

Preserve shared module settings if not override in page module

Environment Info

Angular 17
Angularslickgrid 7

Validations

@ghiscoding
Copy link
Owner

ghiscoding commented Dec 15, 2023

ah right, I changed how external are registered in PR #1320 to avoid the externalResources option to no longer call the internal mergeGridOptions which creates a deep copy of the grid options (creating a possible duplicate instance ref) but I forgot to test it at a global level. I'll fix that later today, thanks for the early feedback. It also look like I'll have to make a last patch version in 6.x as well since that PR was provided and released 2 weeks

protected mergeGridOptions(gridOptions: GridOption): GridOption {
gridOptions.gridId = this.gridId;
gridOptions.gridContainerId = `slickGridContainer-${this.gridId}`;
// if we have a backendServiceApi and the enablePagination is undefined, we'll assume that we do want to see it, else get that defined value
gridOptions.enablePagination = ((gridOptions.backendServiceApi && gridOptions.enablePagination === undefined) ? true : gridOptions.enablePagination) || false;
// use extend to deep merge & copy to avoid immutable properties being changed in GlobalGridOptions after a route change
const options = SlickUtils.extend(true, {}, GlobalGridOptions, this.forRootConfig, gridOptions) as GridOption;

ghiscoding added a commit that referenced this issue Dec 15, 2023
- relates to issue #1329 even though the issue was brought for the new v7, this regression was also pushed on last v6.6.5 so a fix is necessary on v6 as well
ghiscoding added a commit that referenced this issue Dec 15, 2023
fix: regression externalResouces should work globally, fix #1329
@ghiscoding
Copy link
Owner

fixed in v7.0.1 and v6.6.6

@ghiscoding
Copy link
Owner

Sorry I'm not sure what you said, can you provide example so I could understand better?

@lajith111
Copy link
Author

lajith111 commented Dec 16, 2023

sory for my english, ignore my prev comment, just now rechecked the issue..i observed that first i downloaded excel from USerList page its downloaded, after i go to CustomerList page then i click for download excel but error "You must register the ExcelExportService" mesage showing in console
Again i goes to USer List then i also get same error message

Both above case i have commented in component page
// enableExcelExport: true,
// externalResources: [new ExcelExportService()],

i dont no , but it not preserving value in multiple instances of slickgrid

@ghiscoding
Copy link
Owner

I reverted some changes in PR #1331 but did not publish yet, let me try to publish it and hopefully that fixes your problem. Let me do that now

@ghiscoding
Copy link
Owner

please try v7.0.2 and hope it fixes it

@lajith111
Copy link
Author

Its now working fine.. Thank you for quick fix

@ghiscoding
Copy link
Owner

Great thanks for confirming :)

@lajith111
Copy link
Author

lajith111 commented Dec 17, 2023

@ghiscoding after i host to shared server i am getting
main.42ddf1a2709f25d1.js:1 ERROR TypeError: Cannot read properties of undefined (reading 'extensionService')

locally using ng s it is working fine..First time i getting this error.. I am not expertize in JavaScript
i am sure that it is because of slickgrid.. do you have any idea..Thanks

image

Is this because of nodejs?

@ghiscoding
Copy link
Owner

I cannot help without a full reproduction. You should try to click on the link on the errors to see where the error is thrown.

Also please do not ask question or issues that are unrelated to the original issue.

@lajith111
Copy link
Author

lajith111 commented Dec 17, 2023

sory for that,..i thought issue in @slickgrid-universal service becuse i have not made any code changes in the application only i have upgraded any way thanks for the reply...i will check

@ghiscoding
Copy link
Owner

ghiscoding commented Dec 17, 2023

If I cannot reproduce, then I cannot help, which is why I'm asking for a reproduction. There is not enough information to help.

Also the GitHub Live Demo is a production build that is executed on every new release to make sure there is no error with the build, it is also used to run the 600 Cypress E2E tests... so if I cannot reproduce your issue, then I simply cannot help

@lajith111
Copy link
Author

lajith111 commented Dec 20, 2023

ok..thanks i have raised a question in https://stackoverflow.com/questions/77690221/angular-slick-grid-error-after-deployed-package

And also added ng build --verbose details in the question..if you have a time pls check

@ghiscoding
Copy link
Owner

ghiscoding commented Dec 20, 2023

The issue you're facing is the same as another opened issue #1334

It might be caused by the external dependency multiple-select-vanilla that I also maintain and that I started using the code Boolean(..) to convert input to a boolean. I pushed a new version 1.1.2 of that lib yesterday and hopefully that fixes the bug, but I have no confirmation yet if that fixed the issue or not. I will push a new version of Angular-Slickgrid today or tomorrow that will include this code change and again hoping that it closes the problem. Also note that I could not replicate this problem, so it's hard for me to troubleshoot

@ghiscoding
Copy link
Owner

I believe the issues with the major version of Angular-Slickgrid are all fixed now in v7.1.0 🤞🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants