zyzbroker / lightning-esignature

ESignature Salesforce Lightning Component
MIT License
11 stars 7 forks source link

Multiple ESignatures On a page not working #2

Open mingworld opened 6 years ago

mingworld commented 6 years ago

Hi, I have a requirement to have 3 ESignatures on a lightning app. I have created 3 lightning components with one ESignature each. then put these 3 lightning components into a lightning app. Ony the first ESignature is working.

I also tried to put new varible for signatureWrapperID and it is still not working. Can you help? Thanks.

mingworld commented 6 years ago

I got it working! I also need to use this variable on this line in ESignatureHelper.js var wrapper = document.getElementById(cmp.get('v.signatureWrapperID'))

david-onehub-dev commented 6 years ago

Hi, Ming:

Let me take a look. you should be able to do it.

-David Z.


From: Ming Ma notifications@github.com Sent: Wednesday, October 11, 2017 3:48:51 AM To: david-onehub-dev/lightning-esignature Cc: Subscribed Subject: [david-onehub-dev/lightning-esignature] Multiple ESignatures On a page not working (#2)

Hi, I have a requirement to have 3 ESignatures on a lightning app. I have created 3 lightning components with one ESignature each. then put these 3 lightning components into a lightning app. Ony the first ESignature is working.

I also tried to put new varible for signatureWrapperID and it is still not working. Can you help? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/david-onehub-dev/lightning-esignature/issues/2, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATkd4X_DIilDQ_POwTFU-lEjOAsqmxW0ks5srJ0TgaJpZM4P1Rh1.

david-onehub-dev commented 6 years ago

fixed.

please check out the package release link to install updated version. you can also check the code changes on the related commit allow mulstiple signature instances on the same parent component


From: Ming Ma notifications@github.com Sent: Wednesday, October 11, 2017 3:48:51 AM To: david-onehub-dev/lightning-esignature Cc: Subscribed Subject: [david-onehub-dev/lightning-esignature] Multiple ESignatures On a page not working (#2)

Hi, I have a requirement to have 3 ESignatures on a lightning app. I have created 3 lightning components with one ESignature each. then put these 3 lightning components into a lightning app. Ony the first ESignature is working.

I also tried to put new varible for signatureWrapperID and it is still not working. Can you help? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/david-onehub-dev/lightning-esignature/issues/2, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATkd4X_DIilDQ_POwTFU-lEjOAsqmxW0ks5srJ0TgaJpZM4P1Rh1.

mingworld commented 6 years ago

Hi David, Thanks for your help. I tested and it works only if I put all 3 esignature components inside the same lightning component.

My application has one parent LC and multiple children LC. I have a requirement to have 3 esignature on 3 different children LC (i.e. one esignature per child LC).

Can please help?

Thanks

Ming

mingworld commented 6 years ago

Hi David,

I think I found the issue. My App has one parent LC with many children LC. It is a step by step wizard. So when parent LC loaded, It only shows the first child LC and hides the reset child LCs. When a user clicks next button, it hides current child LC and shows next child LC.

The issue is that when e-signatures are loaded on different child LC, it executes "onScriptReady" which set the correct location of the canvas. but my app hides and shows child LCs and it changes the canvas coordinations. I think this is why the first signature works and rest do not.

I put a 'getReady' method on the esignature, and use a button click on the child LC to call this method and this calls onScriptReady

Is there any way to reset the esignaure without a button click?

Thanks

mingworld commented 6 years ago

Hi David,

I found a solution to my problem. Not sure if this is the best solution.

I add onmouseover="{!c.onMouseOver}"> to <div class="mb-signature-container" then call h.init(cmp); once.

onMouseOver: function(cmp, evt, h) { console.log("onMouseOver"); var doneMouseOver = cmp.get("v.mouseOverDone") console.log(doneMouseOver); if (doneMouseOver == false) { cmp.set("v.mouseOverDone", "true"); h.init(cmp); }

Thanks

david-onehub-dev commented 6 years ago

you need to assign different id for esignatrue for different children. each sig has its own document element id. it will not interfere with each other. when saying "hide children', are you using . it is not hiding, it is just remove hidden component from DOM tree. The real hiding is actually through CSS display: none.

mingworld commented 6 years ago

Thanks for your reply. I hide these children components through CSS display: none.

david-onehub-dev commented 6 years ago

Hi, Ming:

One solution is that you create component one by one and not create three components and hide the other two. you can preload the three components but not creating the instance. During the navigation, you can cache the data but not UI. that way, each component is initialized properly.

In addition, I will create an app to simulate your situation.

-David Z.


From: Ming Ma notifications@github.com Sent: Wednesday, October 18, 2017 4:50:08 AM To: david-onehub-dev/lightning-esignature Cc: David Zhao; Comment Subject: Re: [david-onehub-dev/lightning-esignature] Multiple ESignatures On a page not working (#2)

Reopened #2https://github.com/david-onehub-dev/lightning-esignature/issues/2.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/david-onehub-dev/lightning-esignature/issues/2#event-1298898577, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ATkd4QZude2e9fHMn36o7Q3QDoEwHNRiks5steXwgaJpZM4P1Rh1.

mingworld commented 6 years ago

Hi David,

Can you show me how please? Thanks.

Ming