cancel
Showing results for 
Search instead for 
Did you mean: 

DS 1.4 SDK: binding events to DS script

Former Member
0 Kudos

Hi everyone,

I'm trying to implement the new ZTL concepts described by in the last 2 sections of

For first section (named: Binding Events to Design Studio Script Methods), I wasn't able to use the @Visibility(private) directive.

My code in contribution.xml:


<property

  id="onFilterApplied"

  title="Filter Applied"

  type="ScriptText"

  group="Events"

  visible="false"/>

<initialization>

  <defaultValue property="onFilterApplied">this.applyFilter();</defaultValue>

</initialization>

In contribution.ztl:


@Visibility(private)

  void applyFilter(){*

    //...

  *}

Ends up with the error:


Couldn't resolve reference to Member 'applyFilter'.

in script

BREADCRUMBFILTER_2.applyFilter();

Removing @Visibility(private) works fine though!

For second section (Pseudo Event "beforeRender"), I have used the following in contribution.xml:


<defaultValue property="beforeRender">this.onBeforeRender();</defaultValue>

In ZTL:


void onBeforeRender(){*

  APPLICATION.createErrorMessage('before render');

*}

But this seems not to be called at all, with or without @Visibility(private)... It's as if the pseudo-event didn't exist or wasn't triggered.

Any idea on what could be happening?

I couldn't find any information about these new concepts in the developer guide for Design Studio 1.4. Have I missed anything?

Many thanks in advance,

Tanguy

Accepted Solutions (1)

Accepted Solutions (1)

reiner_hille-doering
Active Contributor
0 Kudos

Hi Tanguy,

thanks for testing.

Both of your observations are (unfortunately) true.

The "onBeforeRender" was a typo, that I corrected in the meanting.

The problem with validating your private applyFilter function seems to be simply a bug. Of course if was intended to work as you expected. The "applyFunction" should have been invisible to normal scripts, but visible to the property binding.

It seems that a last minute change now causes this not to work. I will try to fix it in SP1.

Thanks again,

Reiner.

former_member194504
Active Contributor
0 Kudos

Hi Reiner,

Is that means current onBeforeRender wont work with current version??

Former Member
0 Kudos

Hi Reiner,

Thank you for your confirmation.

I will then document my function that it shouldn't be used from BIAL, that's not really a big deal.

Anyway I'm really happy with those ZTL enhancements, they work really well except for the private part, and are a tremendous help for the usability of our Quick Filters extension. We had quite a lot of BIAL script to copy/paste in all applications, they are all integrated into the extension now.

Thanks again Karol and Reiner for your help on this topic.

Best regards,

Tanguy

Former Member
0 Kudos

Hi,

The onBeforeRender pseudo-event works very well on Design Studio 1.4.

The issue is that the @Visibility(false) also hides a method from the contribution.xml instead of only BIAL script from the Design Studio client.

Regards,

Tanguy

former_member194504
Active Contributor
0 Kudos

Thanks Tanguy  for your response

Answers (2)

Answers (2)

Karol-K
Advisor
Advisor
0 Kudos

Hi Tanguy,

the statement "@Visibility(private)" means that this method should be not visible in the BIAL scripting for the user. This can be the case if you want to have some method which you can call internally IN your own ZTL contribution file, but not from the Design Studio Client tool.

Based on this explanation this works correctly, right?

Karol

Former Member
0 Kudos

Hi Karol,

Thank you for your answer.

The code I used is almost a copy of what Reiner wrote in the article I have referenced at the beginning of my first post. All the code is in the contribution.xml or ztl, nothing from the client tool.

Reiner also uses the @Visibility(private) statement for the same use case as I do.

From what you say, I understand we actually can't use it the way Reiner described it, but rather only like a private method would be in Java.

That would make sense then, because my this.applyFilter() has been changed to BREADCRUMBFILTER_2.applyFilter() at runtime. The method being private, it then raises the error.

But then, is there any way I can hide a method that has to be called from contribution.xml only?

Thanks and regards,

Tanguy

Karol-K
Advisor
Advisor
0 Kudos

Hi,

onFilterApplied is an event which is hidden. this event has some default value "this.applyFilter();" - nad this method is private.


in all, this means, you can trigger an event in JS area which will be executed w/o any user involvement inbetween. in last releases, the events were always visible for users, as w/o "this" variable it was not possible to deliver a content for the event.


to your question, this is the way how to hide a method which is called from contribution.xml. the method "applyFilter" is not visible for the user, but you as owner of the SDK component can call it (after some user interaction in the frontend).


can you describe what you want to achieve?


Karol

Former Member
0 Kudos

Hi Karol,


Karol Kalisz wrote:

this is the way how to hide a method which is called from contribution.xml

This is exactly what I am trying to achieve.

I would like to have an internal event to apply filter to a datasource without the application designer to code anything.

I have created an invisible event and have bound it to a ZTL method (property visible="false", type="ScriptText", defaultValue "this.applyFilter();").

The problem is: the ZTL method is available to the application designer without @Visible(false), but cannot be bound to the event if I use @Visible(false).

@Visible(false) seems to hide the method from both design studio client BIAL *and* contribution.xml. So it seems we can't hide a method that is bound to an event.

That means that your statement seems not to be entirely true:


Karol Kalisz wrote:

the method "applyFilter" is not visible for the user, but you as owner of the SDK component can call it (after some user interaction in the frontend).

The applyFilter method is only visible from inside the ZTL, but not in the contribution.xml.

I hope it's more clear now. Please let me know if you'd like to post the code.

Thanks again for your help.

Tanguy

Former Member
0 Kudos

I've just managed to make the pseudo-event work.

Actually the pseudo-event is named "onBeforeRender", instead of "beforeRender" as stated by Reiner in his article.

So the following works now:

<defaultValue property="onBeforeRender">this.doBeforeRender();</defaultValue>

I still would be interested to know how to make the @Visibility(private) work as well, though

Regards,

Tanguy