Hi Denuwathi,

As I explained offline, you should bind/initialize javascript events using
the success event of the renderFragment method. As mentioned, please refer
client-side fragment sample in the uuf-common sample app.


Regards,
Chandana

On Thu, Mar 16, 2017 at 8:41 AM, Denuwanthi De Silva <[email protected]>
wrote:

> Thanks all for valuable suggestions.
>
> When rendering fragment via UUFClient, what we noticed is the
> corresponding front-end js did not pickup.
>
> Therefore, as Rajith mentioned used the onCLick() in the button html tag.
> But it would be more easier if we can do the front-end js logic of the
> fragment inside the fragment public js itself when using
> UUFclient.renderFragment() method to load the fragment
>
> Thanks
>
>
> On Tue, Mar 14, 2017 at 10:31 PM, Manuranga Perera <[email protected]> wrote:
>
>> Fragment is a self contained re usable component. I think its better to
>>>  have the all the front end logic related to the fragment inside that
>>> fragment.
>>>
>> +1
>>
>> On Tue, Mar 14, 2017 at 4:36 PM, Rajith Roshan <[email protected]> wrote:
>>
>>> Hi
>>>
>>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm currently rendering a fragment inside a page using
>>>> 'UUFClient.renderFragment' method.
>>>> Then I display it in the page using "{{#defineZone}} helper.
>>>>
>>>> This fragment contains a button.
>>>> When I click that button I need to do an ajax call to a micro service.
>>>>
>>>> I make the ajax call inside the front-end js of the current page.
>>>> This seems not to be working, as the button is in the fragment.
>>>>
>>> This is may be due to, by the time you are registering the on click
>>> event for button the dom does not actually have the button element, since
>>> uufrender client works asynchronously.
>>> If you use onclick attribute on the button element itself and write your
>>> logic in the current page then this should work. No need to move it to the
>>> fragment.
>>>
>>>>
>>>> So, is it ok to define a front-end js in the fragment and do the ajax
>>>> call from it, instead of the front-end js of the current page .?
>>>>
>>>
>>> Fragment is a self contained re usable component. I think its better to
>>>  have the all the front end logic related to the fragment inside that
>>> fragment.
>>>
>>>>
>>>>
>>>> Thanks
>>>>
>>>> --
>>>> Denuwanthi De Silva
>>>> Senior Software Engineer;
>>>> WSO2 Inc.; http://wso2.com,
>>>> Email: [email protected]
>>>> Blog: https://denuwanthi.wordpress.com/
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Rajith Roshan
>>> Software Engineer, WSO2 Inc.
>>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>>
>>
>>
>>
>> --
>> With regards,
>> *Manu*ranga Perera.
>>
>> phone : 071 7 70 20 50
>> mail : [email protected]
>>
>
>
>
> --
> Denuwanthi De Silva
> Senior Software Engineer;
> WSO2 Inc.; http://wso2.com,
> Email: [email protected]
> Blog: https://denuwanthi.wordpress.com/
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Chandana Napagoda*
Associate Technical Lead
WSO2 Inc. - http://wso2.org

*Email  :  [email protected] <[email protected]>**Mobile : +94718169299*

*Blog  :    http://cnapagoda.blogspot.com <http://cnapagoda.blogspot.com> |
http://chandana.napagoda.com <http://chandana.napagoda.com>*

*Linkedin : http://www.linkedin.com/in/chandananapagoda
<http://www.linkedin.com/in/chandananapagoda>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to