Re: [Dev] [UUF]Handling events of fragments

2017-03-20 Thread Chandana Napagoda
On Mon, Mar 20, 2017 at 4:42 PM, Manuranga Perera  wrote:

> Its not mandatory to use the success event. When Javascript file is
>> loaded, it will bind the events.
>>
> That's what I also assumed, so better to let developer use the normal way
> using $(func(){}) so it works with both uuf client and uuf backbend. So +1
> for Rajith's method.
>

+1, I will update the sample.

Regards,
Chandana

>
> Have no idea why Denuwanthi's way is not working. I also though it should
> be the same.
>
> On Mon, Mar 20, 2017 at 5:35 AM, Chandana Napagoda 
> wrote:
>
>> Hi,
>>
>> I hope you can verify this by modifying the sample available here[1].
>>
>> [1]. http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
>>
>> Regards,
>> Chandana
>>
>> On Mon, Mar 20, 2017 at 10:58 AM, Denuwanthi De Silva <
>> denuwan...@wso2.com> wrote:
>>
>>> Hi Chandana,
>>>
>>> Thank you for the clarification. That can be the issue.
>>> AFAIK  $(function(){}); is normally referred as the short form of
>>> document.ready, how come $(function(){}); is working and not document.ready?
>>>
>>> Thanks
>>>
>>> On Mon, Mar 20, 2017 at 10:45 AM, Chandana Napagoda 
>>> wrote:
>>>
 HI Denuwanthi,

 AFAIK, "document ready" runs only once per page. Since your page is
 already loaded, it will not fire document ready event again.

 Regards,
 Chandana

 On Sat, Mar 18, 2017 at 6:50 PM, Denuwanthi De Silva <
 denuwan...@wso2.com> wrote:

> Hi,
>
> As Rajith mentioned when using the short hand form of document ready
> function [1] it works as expected.
> When using [2] only it does not execute the public js of the fragment.
>
>
>
>
> [1]$(function(){});
> [2]
>
> $(document).ready(function () {});
>
> Thanks,
>
>
> On Sat, Mar 18, 2017 at 4:06 PM, Rajith Roshan 
> wrote:
>
>> Hi,
>>
>> I have used button register event on document ready[1] of the front
>> end js which is inside the fragment(public/js) folder. This works fine 
>> for
>> me. I haven't used success call back for event register.
>>
>>
>> [1] - $(function () {
>>
>> $('#addThrottleBtn').on('click', addPolicyToBackend);
>> });
>>
>> I think this should work for all fragments. If it's not working then
>> its a bug right?
>>
>> Thanks!
>> Rajith
>>
>> On Sat, Mar 18, 2017 at 3:48 PM, Manuranga Perera 
>> wrote:
>>
>>> Why does someone has to use a seccuess event? Can't they just put it
>>> in public/js and get the same result ?
>>>
>>> On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:
>>>
>>> Hi Manu,
>>>
>>> This is not a bug in uuf client. Once js is dynamically loaded, they
>>> can bind events from that javascript. You can verify it by modifying the
>>> sample I have mentioned in my previous mail.
>>>
>>> BTW, could you please elaborate more on what you meant by "special"
>>> fragments?
>>>
>>> Regards,
>>> Chandana
>>>
>>> On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera 
>>> wrote:
>>>
 Hi Denuwanthi, Rajith,

> onCLick()

 Please don't do this, What I meant is to put in public/js dir
 inside the fragment, not in fragment hbs. No JS in HBS please, don't 
 mix
 logic and pretension.

 Hi Napa, Sajith,

> you should bind/initialize javascript events using the success
> event of the renderFragment method.

 I don't think this is a good constraint, that means people have to
 write "spacial" fragments if they want to work with client side. UUF 
 client
 should attach the script after it attaches the HBS, if not it's bug in 
 UUF
 client.

 On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva <
 denuwan...@wso2.com> wrote:

> Hi Chandana,
>
> Thank you, it works .
>
>
> Thanks,
>
> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda <
> chand...@wso2.com> wrote:
>
>> 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 <
>> denuwan...@wso2.com> wrote:
>>
>>> Thanks all for valuable suggestions.
>>>
>>> When rendering fragment via UUFClient, what we noticed is the
>>> corresponding front-end js 

Re: [Dev] [UUF]Handling events of fragments

2017-03-20 Thread Manuranga Perera
>
> Its not mandatory to use the success event. When Javascript file is
> loaded, it will bind the events.
>
That's what I also assumed, so better to let developer use the normal way
using $(func(){}) so it works with both uuf client and uuf backbend. So +1
for Rajith's method.

Have no idea why Denuwanthi's way is not working. I also though it should
be the same.

On Mon, Mar 20, 2017 at 5:35 AM, Chandana Napagoda 
wrote:

> Hi,
>
> I hope you can verify this by modifying the sample available here[1].
>
> [1]. http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
>
> Regards,
> Chandana
>
> On Mon, Mar 20, 2017 at 10:58 AM, Denuwanthi De Silva  > wrote:
>
>> Hi Chandana,
>>
>> Thank you for the clarification. That can be the issue.
>> AFAIK  $(function(){}); is normally referred as the short form of
>> document.ready, how come $(function(){}); is working and not document.ready?
>>
>> Thanks
>>
>> On Mon, Mar 20, 2017 at 10:45 AM, Chandana Napagoda 
>> wrote:
>>
>>> HI Denuwanthi,
>>>
>>> AFAIK, "document ready" runs only once per page. Since your page is
>>> already loaded, it will not fire document ready event again.
>>>
>>> Regards,
>>> Chandana
>>>
>>> On Sat, Mar 18, 2017 at 6:50 PM, Denuwanthi De Silva <
>>> denuwan...@wso2.com> wrote:
>>>
 Hi,

 As Rajith mentioned when using the short hand form of document ready
 function [1] it works as expected.
 When using [2] only it does not execute the public js of the fragment.




 [1]$(function(){});
 [2]

 $(document).ready(function () {});

 Thanks,


 On Sat, Mar 18, 2017 at 4:06 PM, Rajith Roshan 
 wrote:

> Hi,
>
> I have used button register event on document ready[1] of the front
> end js which is inside the fragment(public/js) folder. This works fine for
> me. I haven't used success call back for event register.
>
>
> [1] - $(function () {
>
> $('#addThrottleBtn').on('click', addPolicyToBackend);
> });
>
> I think this should work for all fragments. If it's not working then
> its a bug right?
>
> Thanks!
> Rajith
>
> On Sat, Mar 18, 2017 at 3:48 PM, Manuranga Perera 
> wrote:
>
>> Why does someone has to use a seccuess event? Can't they just put it
>> in public/js and get the same result ?
>>
>> On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:
>>
>> Hi Manu,
>>
>> This is not a bug in uuf client. Once js is dynamically loaded, they
>> can bind events from that javascript. You can verify it by modifying the
>> sample I have mentioned in my previous mail.
>>
>> BTW, could you please elaborate more on what you meant by "special"
>> fragments?
>>
>> Regards,
>> Chandana
>>
>> On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera 
>> wrote:
>>
>>> Hi Denuwanthi, Rajith,
>>>
 onCLick()
>>>
>>> Please don't do this, What I meant is to put in public/js dir inside
>>> the fragment, not in fragment hbs. No JS in HBS please, don't mix logic 
>>> and
>>> pretension.
>>>
>>> Hi Napa, Sajith,
>>>
 you should bind/initialize javascript events using the success
 event of the renderFragment method.
>>>
>>> I don't think this is a good constraint, that means people have to
>>> write "spacial" fragments if they want to work with client side. UUF 
>>> client
>>> should attach the script after it attaches the HBS, if not it's bug in 
>>> UUF
>>> client.
>>>
>>> On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva <
>>> denuwan...@wso2.com> wrote:
>>>
 Hi Chandana,

 Thank you, it works .


 Thanks,

 On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda <
 chand...@wso2.com> wrote:

> 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 <
> denuwan...@wso2.com> 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() 

Re: [Dev] [UUF]Handling events of fragments

2017-03-19 Thread Chandana Napagoda
Hi,

I hope you can verify this by modifying the sample available here[1].

[1]. http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml

Regards,
Chandana

On Mon, Mar 20, 2017 at 10:58 AM, Denuwanthi De Silva 
wrote:

> Hi Chandana,
>
> Thank you for the clarification. That can be the issue.
> AFAIK  $(function(){}); is normally referred as the short form of
> document.ready, how come $(function(){}); is working and not document.ready?
>
> Thanks
>
> On Mon, Mar 20, 2017 at 10:45 AM, Chandana Napagoda 
> wrote:
>
>> HI Denuwanthi,
>>
>> AFAIK, "document ready" runs only once per page. Since your page is
>> already loaded, it will not fire document ready event again.
>>
>> Regards,
>> Chandana
>>
>> On Sat, Mar 18, 2017 at 6:50 PM, Denuwanthi De Silva > > wrote:
>>
>>> Hi,
>>>
>>> As Rajith mentioned when using the short hand form of document ready
>>> function [1] it works as expected.
>>> When using [2] only it does not execute the public js of the fragment.
>>>
>>>
>>>
>>>
>>> [1]$(function(){});
>>> [2]
>>>
>>> $(document).ready(function () {});
>>>
>>> Thanks,
>>>
>>>
>>> On Sat, Mar 18, 2017 at 4:06 PM, Rajith Roshan  wrote:
>>>
 Hi,

 I have used button register event on document ready[1] of the front end
 js which is inside the fragment(public/js) folder. This works fine for me.
 I haven't used success call back for event register.


 [1] - $(function () {

 $('#addThrottleBtn').on('click', addPolicyToBackend);
 });

 I think this should work for all fragments. If it's not working then
 its a bug right?

 Thanks!
 Rajith

 On Sat, Mar 18, 2017 at 3:48 PM, Manuranga Perera 
 wrote:

> Why does someone has to use a seccuess event? Can't they just put it
> in public/js and get the same result ?
>
> On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:
>
> Hi Manu,
>
> This is not a bug in uuf client. Once js is dynamically loaded, they
> can bind events from that javascript. You can verify it by modifying the
> sample I have mentioned in my previous mail.
>
> BTW, could you please elaborate more on what you meant by "special"
> fragments?
>
> Regards,
> Chandana
>
> On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera 
> wrote:
>
>> Hi Denuwanthi, Rajith,
>>
>>> onCLick()
>>
>> Please don't do this, What I meant is to put in public/js dir inside
>> the fragment, not in fragment hbs. No JS in HBS please, don't mix logic 
>> and
>> pretension.
>>
>> Hi Napa, Sajith,
>>
>>> you should bind/initialize javascript events using the success event
>>> of the renderFragment method.
>>
>> I don't think this is a good constraint, that means people have to
>> write "spacial" fragments if they want to work with client side. UUF 
>> client
>> should attach the script after it attaches the HBS, if not it's bug in 
>> UUF
>> client.
>>
>> On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva <
>> denuwan...@wso2.com> wrote:
>>
>>> Hi Chandana,
>>>
>>> Thank you, it works .
>>>
>>>
>>> Thanks,
>>>
>>> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda <
>>> chand...@wso2.com> wrote:
>>>
 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 <
 denuwan...@wso2.com> 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 
> 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 
>> wrote:
>>
>>> Hi
>>>
>>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva 

Re: [Dev] [UUF]Handling events of fragments

2017-03-19 Thread Denuwanthi De Silva
Hi Chandana,

Thank you for the clarification. That can be the issue.
AFAIK  $(function(){}); is normally referred as the short form of
document.ready, how come $(function(){}); is working and not document.ready?

Thanks

On Mon, Mar 20, 2017 at 10:45 AM, Chandana Napagoda 
wrote:

> HI Denuwanthi,
>
> AFAIK, "document ready" runs only once per page. Since your page is
> already loaded, it will not fire document ready event again.
>
> Regards,
> Chandana
>
> On Sat, Mar 18, 2017 at 6:50 PM, Denuwanthi De Silva 
> wrote:
>
>> Hi,
>>
>> As Rajith mentioned when using the short hand form of document ready
>> function [1] it works as expected.
>> When using [2] only it does not execute the public js of the fragment.
>>
>>
>>
>>
>> [1]$(function(){});
>> [2]
>>
>> $(document).ready(function () {});
>>
>> Thanks,
>>
>>
>> On Sat, Mar 18, 2017 at 4:06 PM, Rajith Roshan  wrote:
>>
>>> Hi,
>>>
>>> I have used button register event on document ready[1] of the front end
>>> js which is inside the fragment(public/js) folder. This works fine for me.
>>> I haven't used success call back for event register.
>>>
>>>
>>> [1] - $(function () {
>>>
>>> $('#addThrottleBtn').on('click', addPolicyToBackend);
>>> });
>>>
>>> I think this should work for all fragments. If it's not working then its
>>> a bug right?
>>>
>>> Thanks!
>>> Rajith
>>>
>>> On Sat, Mar 18, 2017 at 3:48 PM, Manuranga Perera  wrote:
>>>
 Why does someone has to use a seccuess event? Can't they just put it in
 public/js and get the same result ?

 On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:

 Hi Manu,

 This is not a bug in uuf client. Once js is dynamically loaded, they
 can bind events from that javascript. You can verify it by modifying the
 sample I have mentioned in my previous mail.

 BTW, could you please elaborate more on what you meant by "special"
 fragments?

 Regards,
 Chandana

 On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera 
 wrote:

> Hi Denuwanthi, Rajith,
>
>> onCLick()
>
> Please don't do this, What I meant is to put in public/js dir inside
> the fragment, not in fragment hbs. No JS in HBS please, don't mix logic 
> and
> pretension.
>
> Hi Napa, Sajith,
>
>> you should bind/initialize javascript events using the success event
>> of the renderFragment method.
>
> I don't think this is a good constraint, that means people have to
> write "spacial" fragments if they want to work with client side. UUF 
> client
> should attach the script after it attaches the HBS, if not it's bug in UUF
> client.
>
> On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva <
> denuwan...@wso2.com> wrote:
>
>> Hi Chandana,
>>
>> Thank you, it works .
>>
>>
>> Thanks,
>>
>> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda > > wrote:
>>
>>> 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 <
>>> denuwan...@wso2.com> 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 
 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 
> wrote:
>
>> Hi
>>
>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
>> denuwan...@wso2.com> 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.

Re: [Dev] [UUF]Handling events of fragments

2017-03-19 Thread Chandana Napagoda
HI Denuwanthi,

AFAIK, "document ready" runs only once per page. Since your page is already
loaded, it will not fire document ready event again.

Regards,
Chandana

On Sat, Mar 18, 2017 at 6:50 PM, Denuwanthi De Silva 
wrote:

> Hi,
>
> As Rajith mentioned when using the short hand form of document ready
> function [1] it works as expected.
> When using [2] only it does not execute the public js of the fragment.
>
>
>
>
> [1]$(function(){});
> [2]
>
> $(document).ready(function () {});
>
> Thanks,
>
>
> On Sat, Mar 18, 2017 at 4:06 PM, Rajith Roshan  wrote:
>
>> Hi,
>>
>> I have used button register event on document ready[1] of the front end
>> js which is inside the fragment(public/js) folder. This works fine for me.
>> I haven't used success call back for event register.
>>
>>
>> [1] - $(function () {
>>
>> $('#addThrottleBtn').on('click', addPolicyToBackend);
>> });
>>
>> I think this should work for all fragments. If it's not working then its
>> a bug right?
>>
>> Thanks!
>> Rajith
>>
>> On Sat, Mar 18, 2017 at 3:48 PM, Manuranga Perera  wrote:
>>
>>> Why does someone has to use a seccuess event? Can't they just put it in
>>> public/js and get the same result ?
>>>
>>> On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:
>>>
>>> Hi Manu,
>>>
>>> This is not a bug in uuf client. Once js is dynamically loaded, they can
>>> bind events from that javascript. You can verify it by modifying the sample
>>> I have mentioned in my previous mail.
>>>
>>> BTW, could you please elaborate more on what you meant by "special"
>>> fragments?
>>>
>>> Regards,
>>> Chandana
>>>
>>> On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera  wrote:
>>>
 Hi Denuwanthi, Rajith,

> onCLick()

 Please don't do this, What I meant is to put in public/js dir inside
 the fragment, not in fragment hbs. No JS in HBS please, don't mix logic and
 pretension.

 Hi Napa, Sajith,

> you should bind/initialize javascript events using the success event
> of the renderFragment method.

 I don't think this is a good constraint, that means people have to
 write "spacial" fragments if they want to work with client side. UUF client
 should attach the script after it attaches the HBS, if not it's bug in UUF
 client.

 On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva <
 denuwan...@wso2.com> wrote:

> Hi Chandana,
>
> Thank you, it works .
>
>
> Thanks,
>
> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda 
> wrote:
>
>> 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 <
>> denuwan...@wso2.com> 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 
>>> 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 
 wrote:

> Hi
>
> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
> denuwan...@wso2.com> 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 

Re: [Dev] [UUF]Handling events of fragments

2017-03-19 Thread Chandana Napagoda
Hi Manu,

Its not mandatory to use the success event. When Javascript file is loaded,
it will bind the events.

Regards,
Chandana

On Sat, Mar 18, 2017 at 3:48 PM, Manuranga Perera  wrote:

> Why does someone has to use a seccuess event? Can't they just put it in
> public/js and get the same result ?
>
> On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:
>
> Hi Manu,
>
> This is not a bug in uuf client. Once js is dynamically loaded, they can
> bind events from that javascript. You can verify it by modifying the sample
> I have mentioned in my previous mail.
>
> BTW, could you please elaborate more on what you meant by "special"
> fragments?
>
> Regards,
> Chandana
>
> On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera  wrote:
>
>> Hi Denuwanthi, Rajith,
>>
>>> onCLick()
>>
>> Please don't do this, What I meant is to put in public/js dir inside the
>> fragment, not in fragment hbs. No JS in HBS please, don't mix logic and
>> pretension.
>>
>> Hi Napa, Sajith,
>>
>>> you should bind/initialize javascript events using the success event of
>>> the renderFragment method.
>>
>> I don't think this is a good constraint, that means people have to write
>> "spacial" fragments if they want to work with client side. UUF client
>> should attach the script after it attaches the HBS, if not it's bug in UUF
>> client.
>>
>> On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva > > wrote:
>>
>>> Hi Chandana,
>>>
>>> Thank you, it works .
>>>
>>>
>>> Thanks,
>>>
>>> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda 
>>> wrote:
>>>
 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 <
 denuwan...@wso2.com> 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 
> 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 
>> wrote:
>>
>>> Hi
>>>
>>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
>>> denuwan...@wso2.com> 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: denuwan...@wso2.com
 Blog: https://denuwanthi.wordpress.com/

 ___
 Dev mailing list
 Dev@wso2.org
 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
>> 

Re: [Dev] [UUF]Handling events of fragments

2017-03-18 Thread Denuwanthi De Silva
Hi,

As Rajith mentioned when using the short hand form of document ready
function [1] it works as expected.
When using [2] only it does not execute the public js of the fragment.




[1]$(function(){});
[2]

$(document).ready(function () {});

Thanks,


On Sat, Mar 18, 2017 at 4:06 PM, Rajith Roshan  wrote:

> Hi,
>
> I have used button register event on document ready[1] of the front end js
> which is inside the fragment(public/js) folder. This works fine for me. I
> haven't used success call back for event register.
>
>
> [1] - $(function () {
>
> $('#addThrottleBtn').on('click', addPolicyToBackend);
> });
>
> I think this should work for all fragments. If it's not working then its a
> bug right?
>
> Thanks!
> Rajith
>
> On Sat, Mar 18, 2017 at 3:48 PM, Manuranga Perera  wrote:
>
>> Why does someone has to use a seccuess event? Can't they just put it in
>> public/js and get the same result ?
>>
>> On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:
>>
>> Hi Manu,
>>
>> This is not a bug in uuf client. Once js is dynamically loaded, they can
>> bind events from that javascript. You can verify it by modifying the sample
>> I have mentioned in my previous mail.
>>
>> BTW, could you please elaborate more on what you meant by "special"
>> fragments?
>>
>> Regards,
>> Chandana
>>
>> On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera  wrote:
>>
>>> Hi Denuwanthi, Rajith,
>>>
 onCLick()
>>>
>>> Please don't do this, What I meant is to put in public/js dir inside the
>>> fragment, not in fragment hbs. No JS in HBS please, don't mix logic and
>>> pretension.
>>>
>>> Hi Napa, Sajith,
>>>
 you should bind/initialize javascript events using the success event of
 the renderFragment method.
>>>
>>> I don't think this is a good constraint, that means people have to write
>>> "spacial" fragments if they want to work with client side. UUF client
>>> should attach the script after it attaches the HBS, if not it's bug in UUF
>>> client.
>>>
>>> On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva <
>>> denuwan...@wso2.com> wrote:
>>>
 Hi Chandana,

 Thank you, it works .


 Thanks,

 On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda 
 wrote:

> 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 <
> denuwan...@wso2.com> 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 
>> 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 
>>> wrote:
>>>
 Hi

 On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
 denuwan...@wso2.com> 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 

Re: [Dev] [UUF]Handling events of fragments

2017-03-18 Thread Rajith Roshan
Hi,

I have used button register event on document ready[1] of the front end js
which is inside the fragment(public/js) folder. This works fine for me. I
haven't used success call back for event register.


[1] - $(function () {

$('#addThrottleBtn').on('click', addPolicyToBackend);
});

I think this should work for all fragments. If it's not working then its a
bug right?

Thanks!
Rajith

On Sat, Mar 18, 2017 at 3:48 PM, Manuranga Perera  wrote:

> Why does someone has to use a seccuess event? Can't they just put it in
> public/js and get the same result ?
>
> On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:
>
> Hi Manu,
>
> This is not a bug in uuf client. Once js is dynamically loaded, they can
> bind events from that javascript. You can verify it by modifying the sample
> I have mentioned in my previous mail.
>
> BTW, could you please elaborate more on what you meant by "special"
> fragments?
>
> Regards,
> Chandana
>
> On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera  wrote:
>
>> Hi Denuwanthi, Rajith,
>>
>>> onCLick()
>>
>> Please don't do this, What I meant is to put in public/js dir inside the
>> fragment, not in fragment hbs. No JS in HBS please, don't mix logic and
>> pretension.
>>
>> Hi Napa, Sajith,
>>
>>> you should bind/initialize javascript events using the success event of
>>> the renderFragment method.
>>
>> I don't think this is a good constraint, that means people have to write
>> "spacial" fragments if they want to work with client side. UUF client
>> should attach the script after it attaches the HBS, if not it's bug in UUF
>> client.
>>
>> On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva > > wrote:
>>
>>> Hi Chandana,
>>>
>>> Thank you, it works .
>>>
>>>
>>> Thanks,
>>>
>>> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda 
>>> wrote:
>>>
 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 <
 denuwan...@wso2.com> 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 
> 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 
>> wrote:
>>
>>> Hi
>>>
>>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
>>> denuwan...@wso2.com> 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: denuwan...@wso2.com
 Blog: https://denuwanthi.wordpress.com/

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev



Re: [Dev] [UUF]Handling events of fragments

2017-03-18 Thread Manuranga Perera
Why does someone has to use a seccuess event? Can't they just put it in
public/js and get the same result ?

On 18 Mar 2017 10:06, "Chandana Napagoda"  wrote:

Hi Manu,

This is not a bug in uuf client. Once js is dynamically loaded, they can
bind events from that javascript. You can verify it by modifying the sample
I have mentioned in my previous mail.

BTW, could you please elaborate more on what you meant by "special"
fragments?

Regards,
Chandana

On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera  wrote:

> Hi Denuwanthi, Rajith,
>
>> onCLick()
>
> Please don't do this, What I meant is to put in public/js dir inside the
> fragment, not in fragment hbs. No JS in HBS please, don't mix logic and
> pretension.
>
> Hi Napa, Sajith,
>
>> you should bind/initialize javascript events using the success event of
>> the renderFragment method.
>
> I don't think this is a good constraint, that means people have to write
> "spacial" fragments if they want to work with client side. UUF client
> should attach the script after it attaches the HBS, if not it's bug in UUF
> client.
>
> On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva 
> wrote:
>
>> Hi Chandana,
>>
>> Thank you, it works .
>>
>>
>> Thanks,
>>
>> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda 
>> wrote:
>>
>>> 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 <
>>> denuwan...@wso2.com> 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 
 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 
> wrote:
>
>> Hi
>>
>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
>> denuwan...@wso2.com> 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: denuwan...@wso2.com
>>> Blog: https://denuwanthi.wordpress.com/
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> 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 : m...@wso2.com
>



 --
 Denuwanthi De Silva
 Senior Software Engineer;
 WSO2 Inc.; http://wso2.com,
 Email: denuwan...@wso2.com
 Blog: https://denuwanthi.wordpress.com/

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev


>>>
>>>
>>> 

Re: [Dev] [UUF]Handling events of fragments

2017-03-18 Thread Chandana Napagoda
Hi Manu,

This is not a bug in uuf client. Once js is dynamically loaded, they can
bind events from that javascript. You can verify it by modifying the sample
I have mentioned in my previous mail.

BTW, could you please elaborate more on what you meant by "special"
fragments?

Regards,
Chandana

On Thu, Mar 16, 2017 at 5:12 PM, Manuranga Perera  wrote:

> Hi Denuwanthi, Rajith,
>
>> onCLick()
>
> Please don't do this, What I meant is to put in public/js dir inside the
> fragment, not in fragment hbs. No JS in HBS please, don't mix logic and
> pretension.
>
> Hi Napa, Sajith,
>
>> you should bind/initialize javascript events using the success event of
>> the renderFragment method.
>
> I don't think this is a good constraint, that means people have to write
> "spacial" fragments if they want to work with client side. UUF client
> should attach the script after it attaches the HBS, if not it's bug in UUF
> client.
>
> On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva 
> wrote:
>
>> Hi Chandana,
>>
>> Thank you, it works .
>>
>>
>> Thanks,
>>
>> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda 
>> wrote:
>>
>>> 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 <
>>> denuwan...@wso2.com> 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 
 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 
> wrote:
>
>> Hi
>>
>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
>> denuwan...@wso2.com> 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: denuwan...@wso2.com
>>> Blog: https://denuwanthi.wordpress.com/
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> 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 : m...@wso2.com
>



 --
 Denuwanthi De Silva
 Senior Software Engineer;
 WSO2 Inc.; http://wso2.com,
 Email: denuwan...@wso2.com
 Blog: https://denuwanthi.wordpress.com/

 ___
 Dev mailing list
 Dev@wso2.org
 http://wso2.org/cgi-bin/mailman/listinfo/dev


>>>
>>>
>>> --
>>> *Chandana Napagoda*
>>> Associate Technical Lead
>>> WSO2 Inc. - http://wso2.org
>>>
>>> *Email  :  chand...@wso2.com **Mobile : +94718169299
>>> 

Re: [Dev] [UUF]Handling events of fragments

2017-03-16 Thread Manuranga Perera
Hi Denuwanthi, Rajith,

> onCLick()

Please don't do this, What I meant is to put in public/js dir inside the
fragment, not in fragment hbs. No JS in HBS please, don't mix logic and
pretension.

Hi Napa, Sajith,

> you should bind/initialize javascript events using the success event of
> the renderFragment method.

I don't think this is a good constraint, that means people have to write
"spacial" fragments if they want to work with client side. UUF client
should attach the script after it attaches the HBS, if not it's bug in UUF
client.

On Thu, Mar 16, 2017 at 4:22 AM, Denuwanthi De Silva 
wrote:

> Hi Chandana,
>
> Thank you, it works .
>
>
> Thanks,
>
> On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda 
> wrote:
>
>> 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 > > 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 
>>> 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 
 wrote:

> Hi
>
> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
> denuwan...@wso2.com> 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: denuwan...@wso2.com
>> Blog: https://denuwanthi.wordpress.com/
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> 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 : m...@wso2.com

>>>
>>>
>>>
>>> --
>>> Denuwanthi De Silva
>>> Senior Software Engineer;
>>> WSO2 Inc.; http://wso2.com,
>>> Email: denuwan...@wso2.com
>>> Blog: https://denuwanthi.wordpress.com/
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> *Chandana Napagoda*
>> Associate Technical Lead
>> WSO2 Inc. - http://wso2.org
>>
>> *Email  :  chand...@wso2.com **Mobile : +94718169299
>> <+94%2071%20816%209299>*
>>
>> *Blog  :http://cnapagoda.blogspot.com 
>> | http://chandana.napagoda.com *
>>
>> *Linkedin : http://www.linkedin.com/in/chandananapagoda
>> *
>>
>>
>
>
> --
> Denuwanthi De Silva
> Senior Software Engineer;
> WSO2 Inc.; http://wso2.com,
> Email: denuwan...@wso2.com
> Blog: https://denuwanthi.wordpress.com/
>



-- 
With regards,
*Manu*ranga Perera.

phone : 071 7 70 20 50
mail : m...@wso2.com

Re: [Dev] [UUF]Handling events of fragments

2017-03-15 Thread Denuwanthi De Silva
Hi Chandana,

Thank you, it works .


Thanks,

On Thu, Mar 16, 2017 at 9:46 AM, Chandana Napagoda 
wrote:

> 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 
> 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  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  wrote:
>>>
 Hi

 On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
 denuwan...@wso2.com> 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: denuwan...@wso2.com
> Blog: https://denuwanthi.wordpress.com/
>
> ___
> Dev mailing list
> Dev@wso2.org
> 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 : m...@wso2.com
>>>
>>
>>
>>
>> --
>> Denuwanthi De Silva
>> Senior Software Engineer;
>> WSO2 Inc.; http://wso2.com,
>> Email: denuwan...@wso2.com
>> Blog: https://denuwanthi.wordpress.com/
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Chandana Napagoda*
> Associate Technical Lead
> WSO2 Inc. - http://wso2.org
>
> *Email  :  chand...@wso2.com **Mobile : +94718169299
> <+94%2071%20816%209299>*
>
> *Blog  :http://cnapagoda.blogspot.com 
> | http://chandana.napagoda.com *
>
> *Linkedin : http://www.linkedin.com/in/chandananapagoda
> *
>
>


-- 
Denuwanthi De Silva
Senior Software Engineer;
WSO2 Inc.; http://wso2.com,
Email: denuwan...@wso2.com
Blog: https://denuwanthi.wordpress.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF]Handling events of fragments

2017-03-15 Thread Chandana Napagoda
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 
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  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  wrote:
>>
>>> Hi
>>>
>>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva <
>>> denuwan...@wso2.com> 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: denuwan...@wso2.com
 Blog: https://denuwanthi.wordpress.com/

 ___
 Dev mailing list
 Dev@wso2.org
 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 : m...@wso2.com
>>
>
>
>
> --
> Denuwanthi De Silva
> Senior Software Engineer;
> WSO2 Inc.; http://wso2.com,
> Email: denuwan...@wso2.com
> Blog: https://denuwanthi.wordpress.com/
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


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

*Email  :  chand...@wso2.com **Mobile : +94718169299*

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

*Linkedin : http://www.linkedin.com/in/chandananapagoda
*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF]Handling events of fragments

2017-03-15 Thread Denuwanthi De Silva
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  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  wrote:
>
>> Hi
>>
>> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva > > 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: denuwan...@wso2.com
>>> Blog: https://denuwanthi.wordpress.com/
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> 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 : m...@wso2.com
>



-- 
Denuwanthi De Silva
Senior Software Engineer;
WSO2 Inc.; http://wso2.com,
Email: denuwan...@wso2.com
Blog: https://denuwanthi.wordpress.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF]Handling events of fragments

2017-03-14 Thread Manuranga Perera
>
> 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  wrote:

> Hi
>
> On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva 
> 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: denuwan...@wso2.com
>> Blog: https://denuwanthi.wordpress.com/
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> 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 : m...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF]Handling events of fragments

2017-03-14 Thread Rajith Roshan
Hi

On Tue, Mar 14, 2017 at 7:32 PM, Denuwanthi De Silva 
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: denuwan...@wso2.com
> Blog: https://denuwanthi.wordpress.com/
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Rajith Roshan
Software Engineer, WSO2 Inc.
Mobile: +94-72-642-8350 <%2B94-71-554-8430>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [UUF]Handling events of fragments

2017-03-14 Thread Manuranga Perera
Hi Denuwanthi,
This is not a UUF related issue, this is how DOM works. To fix register
listener to a higher node [1]. In the given sample they are using
'document', but as a best practice you should use the closest know parent,
eg: parent div of the zone you are rendering the fragment into.
For more info on how this works please read more on dom even model [2].


[1]
http://stackoverflow.com/questions/19371141/jquery-on-isnt-binding-click-events-to-dynamically-created-elements
[2] http://javascript.info/tutorial/bubbling-and-capturing

On Tue, Mar 14, 2017 at 2:02 PM, Denuwanthi De Silva 
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.
>
> 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 .?
>
>
> Thanks
>
> --
> Denuwanthi De Silva
> Senior Software Engineer;
> WSO2 Inc.; http://wso2.com,
> Email: denuwan...@wso2.com
> Blog: https://denuwanthi.wordpress.com/
>



-- 
With regards,
*Manu*ranga Perera.

phone : 071 7 70 20 50
mail : m...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [UUF]Handling events of fragments

2017-03-14 Thread Denuwanthi De Silva
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.

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 .?


Thanks

-- 
Denuwanthi De Silva
Senior Software Engineer;
WSO2 Inc.; http://wso2.com,
Email: denuwan...@wso2.com
Blog: https://denuwanthi.wordpress.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev