keirbowden / sigcapapp

Signature Capture Samples
MIT License
9 stars 5 forks source link

Not able to pull the "ui:button" from the managed package #10

Closed kannayash closed 6 years ago

kannayash commented 6 years ago

Hi Team, This is our code where we are trying to get the buttons from BGSIGCAP.Below is the code var buttons = component.find({ instancesOf : "ui:button" }); From last week we are getting null for the buttons. And we are using this component for mobile we are not seeing this for all devices(IOS majorly). Can anyone please help me on this? Is anything changed from any latest update? Mentioning it again that our code is not able to get the buttons from the managed package.

Thanks, Yash, 571-439-9466, yashwanth.thota@ecolab.com

keirbowden commented 6 years ago

Hi Yash,

Nothing has changed in terms of visibility of the package items, the only changes made recently have been the component itself supporting additional interfaces.

If you have the locker service enabled then I wouldn't expect you to be able to find the buttons inside of the signature capture component, as it's in a separate namespace, so maybe Salesforce have changed something in there that is now blocking you.

What is the use case for needing access to the buttons directly?

kannayash commented 6 years ago

Thanks for your reply. After capturing the click event on the Save button for the signature we are calling our internal lightning component to save the signature into the database. But, our lightning component is not able to pull the buttons from the Managed Package which is not able to capture the click event as well.

This is the code we are using to get the buttons: var buttons = component.find({ instancesOf : "ui:button" });

Please let me know if you have any more questions.

kannayash commented 6 years ago

Hello, I was able to figure out a workaround for this by capturing the SignatureCapturedEvt from the package. I am looking for an example code in the repo. But when I downloaded the code. I didnot get the SigCapApp folder in the code base. Do I need to download something else?

Below is example of what I am talking about.

Create your own Lightning Component Action encapsulating the Signature Capture functionality - see the blog post and check out the example code at src/aura/SigCapApp

keirbowden commented 6 years ago

Hi Yash,

Cool - that was going to be my recommendation.

SigCapApp was a typo in the README - it should have been SigCapAction which is in the repo. I've updated the README to give the correct path.

kannayash commented 6 years ago

Yes,Thanks for your reply. I got it. It worked. Now I am facing another issue. I am not able to pull the canvas with the id 'paint'. Below is the code I am trying with. var paintCanvas = document.getElementById('paint') Here paintcanvas is return null in my Ipad and Iphone. But this is working fine when I am using a chrome extensions(Salesforce Mobile app Simulator) to test the signature. Is there any other way to pull the canvas? Appreciate your help.

keirbowden commented 6 years ago

Hi Yash,

That will be the locker service stopping you getting at the internals of the managed component I reckon. I think this approach is always going to fail at some point, as anything you do get working is taking advantage of loopholes in the locker service that will eventually be closed. Also, I can't guarantee that I won't change how it works internally which would break anything that you are relying on that I haven't officially exposed.

My advice would be to raise feature requests for what you actually want to do. E.g. if you want the contents of the canvas prior to saving, ask for a feature that enables that.