on 11-11-2004 3:31 PM
hello,
i am using htmlb:tree with table type tview2. and
i want to display an image(not in mime,dynamic) when i click tree node within the page.
how can i do this.
if any one help great!
thanks in advance.
ravi
hello craig and max,
i am sorry for not giving more details.
i have used , to upload an image export to database..id..
i have used for tree content tview2(table),and now i am able to display tree with content on browser.now my problem is i have to use import parameter to download image from database.and also
when i click(open) on tree node image should be displayed next to the tree node.
now how to handle this problem.
thanx in advance.
regards
ravi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure if I understand so let me say what I think you are asking and you tell me if I am right.
You have a treeNode and you display the content of the treenode from a table. You build the treeNode from the table.
Now you have to get an image from a database with a parameter.
You want the image to display when you click on the treenode item.
Is this correct?
If so then in your treeNode onClick event is probably what you need.
When someone clicks the item in the treenode the OnInputProcessing Event Handler fires, normal BSP without MVC, Max will answer for MVC
In the OnInputProcessing you read the ID of the treeNode item clicked (if you build the treeNode then you could assign the image parameter as the ID of the treeNode item) you then load in your Page Layout the image from the database with your ID value as parameter.
yes craig u r right.and my application is normal bsp.
and i am building the tree node.(infact it is 3rd level in hierarchy, for hierarchy and tview2 table filling am using a method thru application object in onintialization).(note:i have tried following trial
when i click treenode i am able to display some page inline thru navigation->goto_page(page.htm)).
if u have some examples on this please send to me.
i am very new to BSP.
and thanx for your early reply.
regards ravi.
<a href="/people/brian.mckellar/blog/2004/06/11/bsp-trouble-shooting-getting-help">BSP Trouble Shooting: Getting Help</a>
I would recommend that you load the BSP Application in SE80 called SBSPEXT_HTMLB and take a look at the examples.
I would then suggest looking at this as a possible solution.
Build a grid layout on your page columnSize 2 and rowSize 1.
In the first gridlayoutCell put your treenode.
in the second gridlayoutcell (column 2) is where you will display the image. So create a Page attribute to store your treenode ID in. The in the OnInputProcessing event handler read the treenode (examples found in SBSPEXT_HTMLB) and store the ID in the attribute you created.
Now on your Page Layout
<% IF myID IS NOT INITIAL. %>
<img src="<%= loadDBImage( id = myID ) %>" border="0">
<% ENDIF. %>
In this example you have a method in a class file that loads the image link from the DB for the ID you give it.
If you need specific code you'll have to wait a bit it'S 4 AM and I want to sleep now
hello craig,
this is my code.
the method read_packages is written by somebodyelse.still confusing.
i want to read level3node id and using it want to display
image in the grid as u said.
if u get any idea please let me know.
********************************************************
onintialization.*******
CALL METHOD application->BUILD_PACKAGES
IMPORTING
T_TVIEW2 = tview2.
*******************************
oninputprocessing
*************
CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
Optional: test that this is an event from HTMLB library.
IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
Scenario 1: Read event from manager.
DATA: event TYPE REF TO CL_HTMLB_EVENT.
event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
IF event IS NOT INITIAL.
DATA: tree_event TYPE REF TO CL_HTMLB_EVENT_TREE.
data: lv_node type znode.
case event->name.
when 'tree'.
tree_event ?= event.
if tree_event->id EQ 'packages'.
if tree_event->server_event EQ 'onnodeclick' or
tree_event->server_event EQ 'ONNODECLICK'.
lv_node = tree_event->node.
endif.
endif.
endcase.
endif.
ENDIF.
*********************************************
layout
**********************
and ***************************************************
building tree.
***********************
method BUILD_PACKAGES .
data: aux_char3(3).
data: ws_zpro_pa type zpro_pa.
data: ws_zpro_pa_hier type zpro_pa_hier.
data: aux_package_line type package_line,
aux_package_tab type package_tab.
data: aux_string type string.
data: aux_level1 type string.
data: aux_level2 type string.
*data: aux_detail type string.
data: aux_text type string.
data: aux_link type string.
data: aux_tview_line type TVIEWNODE2.
data: aux_char(255).
data: aux_char1(255).
1. Schritt : Lesen der relevanten Packages
select * from ZPRO_PA into ws_zpro_pa
where ZPR_INTERNET_REL = 'X'.
Die ersten drei Stellen für Package-Typen
aux_char3 = ws_zpro_pa-PPL_PACKAGE+0(3).
select single * from zpro_pa_hier into ws_zpro_pa_hier
where ZPRO_PACK_HIER = aux_char3.
check: sy-subrc = 0.
aux_package_line-ZPRO_PACK_HIER = ws_zpro_pa_hier-zpro_pack_hier.
aux_package_line-ZPRO_PACK_TYPE = ws_zpro_pa_hier-zpro_pack_type.
aux_package_line-ppl_package = ws_zpro_pa-ppl_package.
append aux_package_line to aux_package_tab.
endselect.
2. Schritt : Aufbau des Hierarchie-Baums
sort aux_package_tab.
refresh t_tview2.
loop at aux_package_tab into aux_package_line.
Bei jeden neuen 1.level
at new zpro_pack_type.
aux_level1 = aux_package_line-zpro_pack_type.
"Hole noch den Text zum Package-Type
aux_char = aux_level1.
CALL FUNCTION 'Z_S_GET_DOMAIN_FIX_VALUE'
EXPORTING
I_DOMAIN = 'ZPRO_PACK_TYPE'
I_VALUE = aux_char
I_LANGUAGE = 'D'
IMPORTING
E_TEXT = aux_char1.
aux_text = aux_char1.
CALL METHOD me->add_node
exporting i_parentid = ''
i_childid = aux_level1
i_text = aux_text
i_link = ''
i_click = ''
i_status = 'closed'
i_tlevel = '1'
changing t_tview2 = t_tview2.
endat.
Bei jeden neuen 2.level
at new zpro_pack_hier.
aux_level2 = aux_package_line-zpro_pack_hier.
select single ZPRO_PACK_HIER_T from zpro_pa_hier
into aux_text
where zpro_pack_hier = aux_package_line-zpro_pack_hier.
CALL METHOD me->add_node
exporting i_parentid = aux_level1
i_childid = aux_level2
i_text = aux_text
i_link = ''
i_click = ''
i_status = 'closed'
i_tlevel = '2'
changing t_tview2 = t_tview2.
endat.
Pro Package
select single descr from zppl_pa into aux_text
where packid = aux_package_line-ppl_package.
aux_detail = aux_package_line-ppl_package.
CALL METHOD me->add_node
exporting i_parentid = aux_level2
i_childid = aux_detail
i_text = aux_text
i_link = ''
i_click = 'aux_detail'
i_status = 'final'
i_tlevel = '3'
changing t_tview2 = t_tview2.
endloop.
As I said before in OnInputProcessing you read the ID value of your treenode then in the Page Layout you output the image.
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<htmlb:page title="Package Search" >
<htmlb:form>
<htmlb:gridLayout columnSize = "2"
rowSize = "1" >
<htmlb:gridLayoutCell columnIndex = "1"
rowIndex = "1" >
<htmlb:tree id = "Packages"
title = "Packages"
table2 = "<%= tview2 %>"
onNodeClick ="MyTreeNodeClick" />
</htmlb:gridLayoutCell>
<htmlb:gridLayoutCell columnIndex = "2"
rowIndex = "1" >
<% IF lv_node IS NOT INITIAL. %>
<img src="<%= loadDBImage( id = lv_node ) %>" border="0">
<% ENDIF. %>
</htmlb:gridLayoutCell>
</htmlb:gridLayout>
</htmlb:form>
</htmlb:page>
</htmlb:content>
You of course now have to build a method "loadDBImage" that accepts an Importing parameters called ID. Provided that your BUILD_PACKAGES method sets the treeNode ID to that of your Image ID in the database this will work just fine.
So now whenever you click a treeNode you reload the image.
Oh, lv_node is set as a Page Attribute and set during the OnInputProcessing.
hai craig ,
thanx for replies.
as i am using build_packages method to build a tree, am not able to find treenode id(one particular).
now am using in the layout
<%
if request->get_form_field( 'TPackagesPMQFP128-1' ) is not initial.
%>
<img src="<%= application->loadimage( id = application->lv_node ) %>" border="0">
but for all child nodes (level3) when i click am able to print the same picture only.
i think i have a problem in reading treenode id.
can u say some thing by observing my method.
further info
method ADD_NODE .
data: aux_tview_line type TVIEWNODE2.
aux_tview_line-TREEID = 'PACKAGE_TREE'.
aux_tview_line-parentid = i_parentid.
aux_tview_line-childid = i_childid.
aux_tview_line-text = i_text.
aux_tview_line-link = i_link.
aux_tview_line-target = i_target.
aux_tview_line-click = i_click.
aux_tview_line-STATUS = i_status.
aux_tview_line-tlevel = i_tlevel.
append aux_tview_line to t_tview2.
aux_tview_line-childid = aux_detail.
endmet
If the ID of the image is assigned to the treenode ID then you just read the treenode ID. Your build packages is not used until after the OnInputProcessing or after you've read the treenode.
The treenode with all of it's ID are sitting there in the request waiting to be read.
At what point to do you fill lv_node? How do you read your Tree Object to get the ID?
hello craig,
actually i am uploading image(as bin type) using gui_upload.
and exporting as tab to database(area) with some id.
and importing as tab from database.
i need to diplay this image when i click treenode.
Now the problem is after importing as tab from DB i am not able to display it since it is binary. i need to convert it into jpg.
do u have any idea craig?.
Hi there,
please state more exactly where you need help.
Is it the image part? Or how to place/react on an event in tree node?
Also, where should this image be displayed? Next to the treenode? On a separate page?
Providing more information will increase the chance of more people answering
Max
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.