cancel
Showing results for 
Search instead for 
Did you mean: 

htmlb:tree link clientclick

Former Member
0 Kudos

Hi,

I have a htmlb tree and using table2 attribute for its client click option.

when i set the link attribute , the clientclick dosent work.

Anybody has seen this behaviour? Is this is by design? Any work around?

Regards

Raja

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Can you be a bit more specific? Maybe a code sample?

athavanraja
Active Contributor
0 Kudos

<u><b>layout code</b></u>


<htmlb:tree id               = "Hier0"
           table2           = "<%= i_tree20 %>"
           title            = "<%= htitle0 %>"
           width            = "100%"
                          height           = "100%"
                          showTitle        = "true"
                          toggle           = "true"
                          restoreViewState = "true" />

<b>i_tree20</b> has the following fields.

TREEID 
PARENTID
CHILDID
IMG
LINK
TEXT
TLEVEL
STATUS
SIBLID
CLICK
TARGET
TOGGLE
TOOLTIP
SELECTION
TEXTDIRECTION
CLIENTCLICK

i had set the link property of i_tree20 to 'detail.htm'

target property of i_tree20 to 'right' (name of the frame) and

clientclick = 'javascript:alert("i_tree20-childid")'.

In this scenario the clientclick is not working, i have used the client click in other scenarios where treenode link property is not used.

Hope i am clear.

Regards

Raja

Former Member
0 Kudos

I might be just not thinking deep enough and that is why I asked for the code sample but if you are using "clientclick" then I can understand the problem the correct parameter is "OnClientClick", but as I said I might not be thinking deep enough.

athavanraja
Active Contributor
0 Kudos

just check out the field list i have given for the table (used in table2 parameter of the htmlb:tree). there is a field called clientclick which i need to fill up (for e.g alert("test");) for client click action.

Regards

Raja

Former Member
0 Kudos

In understand what you are trying Raja.

Here is an example from SBSPEXT_HTMLB Tree.bsp


<%
data:
     tab type tview2,
     wa_tab like line of tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = ''.
wa_tab-childid = 'root'.
wa_tab-text = 'Root'.
wa_tab-link = 'http://www.sap.com'.
wa_tab-click = 'Hello'.
wa_tab-STATUS   = 'open'.
wa_tab-tlevel = '1'.
append wa_tab to tab.


clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'root'.
wa_tab-childid = 'node1'.
wa_tab-text = 'node1'.
wa_tab-status = 'open'.
wa_tab-tlevel = '2'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'node1'.
wa_tab-childid = 'node11'.
wa_tab-text = 'node11'.
wa_tab-STATUS   = 'final'.
wa_tab-tlevel = '3'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'node1'.
wa_tab-childid = 'node12'.
wa_tab-text = 'node12'.
wa_tab-click = 'node12'.
wa_tab-STATUS   = 'final'.
wa_tab-tlevel = '3'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'root'.
wa_tab-childid = 'node2'.
wa_tab-textdirection = 'LTR'.
wa_tab-text = '20 10 node2 with textdirection LTR'.
wa_tab-click = 'node2'.
wa_tab-STATUS   = 'closed'.
wa_tab-tlevel = '2'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'node2'.
wa_tab-childid = 'node21'.
wa_tab-text = 'node21'.
wa_tab-STATUS   = 'final'.
wa_tab-tlevel = '3'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'node2'.
wa_tab-childid = 'node22'.
wa_tab-text = 'node22'.
wa_tab-STATUS   = 'final'.
wa_tab-tlevel = '3'.
append wa_tab to tab.


clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'root'.
wa_tab-childid = 'node3'.
wa_tab-textdirection = 'LTR'.
wa_tab-text = '20 10 node3 with textdirection LTR'.
wa_tab-link = 'http://www.sap.com'.
wa_tab-STATUS   = 'open'.
wa_tab-tlevel = '2'.
append wa_tab to tab.
 %>
      <htmlb:tree id="myTree4" table2="<%=tab%>"/>

If we change one of those items like you have to


<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = " ">
    <htmlb:form>

<%
data:
     tab type tview2,
     wa_tab like line of tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = ''.
wa_tab-childid = 'root'.
wa_tab-text = 'Root'.
wa_tab-link = 'http://www.sap.com'.
wa_tab-click = 'Hello'.
wa_tab-STATUS   = 'open'.
wa_tab-tlevel = '1'.
append wa_tab to tab.


clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'root'.
wa_tab-childid = 'node1'.
wa_tab-text = 'node1'.
wa_tab-status = 'open'.
wa_tab-tlevel = '2'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'node1'.
wa_tab-childid = 'node11'.
wa_tab-text = 'node11'.
wa_tab-STATUS   = 'final'.
wa_tab-tlevel = '3'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'node1'.
wa_tab-childid = 'node12'.
wa_tab-text = 'node12'.
wa_tab-STATUS   = 'final'.
wa_tab-tlevel = '3'.
wa_tab-link = 'http://www.cmehil.com'.
wa_tab-target = '_blank'.
wa_tab-clientclick = 'javascript:alert("here I am")'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'root'.
wa_tab-childid = 'node2'.
wa_tab-textdirection = 'LTR'.
wa_tab-text = '20 10 node2 with textdirection LTR'.
wa_tab-click = 'node2'.
wa_tab-STATUS   = 'closed'.
wa_tab-tlevel = '2'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'node2'.
wa_tab-childid = 'node21'.
wa_tab-text = 'node21'.
wa_tab-STATUS   = 'final'.
wa_tab-tlevel = '3'.
append wa_tab to tab.

clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'node2'.
wa_tab-childid = 'node22'.
wa_tab-text = 'node22'.
wa_tab-STATUS   = 'final'.
wa_tab-tlevel = '3'.
append wa_tab to tab.


clear wa_tab.
wa_tab-treeid = 'myTree4'.
wa_tab-parentid = 'root'.
wa_tab-childid = 'node3'.
wa_tab-textdirection = 'LTR'.
wa_tab-text = '20 10 node3 with textdirection LTR'.
wa_tab-link = 'http://www.sap.com'.
wa_tab-STATUS   = 'open'.
wa_tab-tlevel = '2'.
append wa_tab to tab.
 %>
      <htmlb:tree id="myTree4" table2="<%=tab%>"/>

    </htmlb:form>
  </htmlb:page>
</htmlb:content>

It works I get the user event at least the click but no longer the JS Alert, if I take out the link property I get the JS Alert. So it does look as though the link property takes priority over the clientclick however in the client click you can also use it to open up a page or new window. So now that we have established that this does seem to be the case I would suggest the only work around you have is to load the page load "link" into the clientclick javascript call.

Perhaps someone else will pop in with a suggestion as well.

athavanraja
Active Contributor
0 Kudos

Hi,

thanks for taking time to simulate the scenario.

Now you have come to my question. is this by design or bug. I havent cheked the OSS yet.

I will post the results, i am successful.

Regards

Raja

Former Member
0 Kudos

I'm thinking design, I mean you can't have two actions at once and a link click is an action and a clientclick is an action however your clientclick can call a page using JavaScript.

athavanraja
Active Contributor
0 Kudos

I just wanted to iform the user what's that action of clicking the link is going to be (thur alert) and then continue navigate to the link action.

Regards

Raja

Former Member
0 Kudos

Then do the alert then the navigation. Good idea but I think the only way is the workaround using only JavaScript.

former_member181879
Active Contributor
0 Kudos

Craig is correct. Either link or JavaScript. If you want both, use clientclick. First do your alert call and then the navigation. Something such as:


alert('Bye...');document.location.href='http://sdn.sap.com';

brian

athavanraja
Active Contributor
0 Kudos

Thanks.

I am doing multiple javascript calls in the client click to achieve this.

But my original question was

<u><b>Either link or JavaScript</b></u> is by design? in tree control.

Regards

Raja

Former Member
0 Kudos

And the answer is YES by design you can use one or the other but not both together.

Answers (0)