purtuga / SPWidgets

Sharepoint Custom UI Widgets
74 stars 34 forks source link

SPControlUpload Post Render callback #73

Closed AaronJWhite closed 7 years ago

AaronJWhite commented 7 years ago

Hello Paul,

This is an enhancement request. Would it be possible to add a postRender setting to act as a callback for when the SPControlUpload widget has rendered? I am using this widget on a dynamically generated form and I need to know when the widget is finished adding itself to the DOM. It would be really useful to be able to run a function once I'm sure the widget is done doing it's thing.

Thanks for the useful widgets!

purtuga commented 7 years ago

Hi Aaron.  I'll see if can carve out some time this weekend to look into it. I think there may already be a way to detect that the widget is ready by setting the onPageChange callback and the looking at the event object that the callback is given on input when called.  I'll post back.  Paul

-- sent from mobile

AaronJWhite commented 7 years ago

Ok, thank you.

purtuga commented 7 years ago

Hi Aaron, Try this to see if it works for you

    .SPControlUpload({
        ....
        onPageChange:   function(ev){
            if (ev.state == 1) { 
                  // ready for user interaction
            }
       }
    });
purtuga commented 7 years ago

Hi @AaronJWhite - I did not hear back from you, so I assume what I suggested worked... Feel free to re-open this if there is something else you need.