Icon in tree view control
Hi all
I want to display an icon in tree view.These icons must be displayed before the node.for this purpose i am using below code.But i didn't find the icon in my output.Please help me to do this.
Thanks in advance.
REPORT ZTREEVIEW_TEST_PROGRAM no standard page heading.
Type-pools : fibs,stree.
data : t_node type snodetext.
data : node_tab like t_node occurs 0 with header line.
clear : node_tab, node_tab[].
node_tab-type = 'T'.
node_tab-name = 'Earth'.
node_tab-tlevel = '01'.
node_tab-nlength = '5'.
node_tab-color = '4'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
node_tab-NODEICON = 'C:\Program Files\SAP\FrontEnd\SAPgui\bitmap\l_b_odsa'.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Europe'.
node_tab-tlevel = '02'.
node_tab-nlength = '6'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 4.
node_tab-NODEICON = 'C:\Program Files\SAP\FrontEnd\SAPgui\bitmap\l_b_odsa.bmp'.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Germany'.
node_tab-tlevel = '03'.
node_tab-nlength = '7'.
node_tab-color = '4'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 4.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Berlin'.
node_tab-tlevel = '04'.
node_tab-nlength = '6'.
node_tab-color = '4'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Asia'.
node_tab-tlevel = '02'.
node_tab-nlength = '4'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'India'.
node_tab-tlevel = '03-'.
node_tab-nlength = '5'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Bombay'.
node_tab-tlevel = '04-'.
node_tab-nlength = '6'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
append node_tab.
clear node_tab.
CALL FUNCTION 'RS_TREE_CONSTRUCT'
EXPORTING
INSERT_ID = '000000'
RELATIONSHIP = ' '
LOG =
TABLES
NODETAB = node_tab
EXCEPTIONS
TREE_FAILURE = 1
ID_NOT_FOUND = 2
WRONG_RELATIONSHIP = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: type_mapping TYPE stree_ctl_type_mapping_tab.
DATA: wa_type TYPE stree_ctl_type_mapping.
CLEAR: type_mapping[].
wa_type-type = 'A'.
wa_type-icon = '@BL@'.
APPEND wa_type TO type_mapping.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
LAYOUT_MODE = ' '
USE_CONTROL = STREE_USE_LIST.
Regards
Giri
Giri,
you can use SAP standard icons only - see table ICON and include TYPE-POOLS: icon in your program.
If you can't use standard icon, it will be more complex.
Regards,
Clemens
Similar Messages
-
Displaying icons in tree view control
Hi all
i am trying to display icons in my tree view control.I am using beow code but i am not getting the ouput.Please help me.
Type-pools : fibs,stree , ICON.
data : t_node type snodetext.
data : node_tab like t_node occurs 0 with header line,
it_icon_id type icon-id.
clear : node_tab, node_tab[].
select single id from icon into it_icon_id
where name = 'ICON_CUSTOMER'.
node_tab-type = 'T'.
node_tab-name = 'Earth'.
node_tab-tlevel = '01'.
node_tab-nlength = '5'.
node_tab-color = '4'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 3.
node_tab-NODEICON = it_icon_id.
append node_tab.
clear node_tab.
node_tab-type = 'P'.
node_tab-name = 'Europe'.
node_tab-tlevel = '02'.
node_tab-nlength = '6'.
node_tab-color = '1'.
node_tab-text = 'Hello'.
node_tab-tlength ='5'.
node_tab-tcolor = 4.
node_tab-NODEICON = it_icon_id.
append node_tab.
clear node_tab.
CALL FUNCTION 'RS_TREE_CONSTRUCT'
EXPORTING
INSERT_ID = '000000'
RELATIONSHIP = ' '
LOG =
TABLES
NODETAB = node_tab
EXCEPTIONS
TREE_FAILURE = 1
ID_NOT_FOUND = 2
WRONG_RELATIONSHIP = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DATA: type_mapping TYPE stree_ctl_type_mapping_tab.
DATA: wa_type TYPE stree_ctl_type_mapping.
CLEAR: type_mapping[].
wa_type-type = 'A'.
wa_type-icon = '@A0@'.
APPEND wa_type TO type_mapping.
CALL FUNCTION 'RS_TREE_CONTROL_PREPARE'
EXPORTING
CONTROL_PATTERN = 'PH'
MULTIPLE_SELECTION = 'X'
TYPE_MAPPING = type_mapping.
CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
EXPORTING
LAYOUT_MODE = ' '
USE_CONTROL = STREE_USE_LIST.
Thank you.
Regards
Giri.Here is another option using <ICON> include,
*& Report ZKB_TREE_EXAMPLE
REPORT zkb_tree_example.
INCLUDE <icon>.
TYPES: BEGIN OF t_sbook,
customid TYPE sbook-customid,
fldate TYPE sbook-fldate,
bookid TYPE sbook-bookid,
END OF t_sbook.
DATA: i_sbook TYPE TABLE OF t_sbook,
w_sbook TYPE t_sbook.
SELECT-OPTIONS: s_custid FOR w_sbook-customid.
DATA: o_custom_container TYPE REF TO cl_gui_custom_container,
o_tree TYPE REF TO cl_gui_simple_tree.
TYPES: t_node_table LIKE TABLE OF trstree.
DATA: i_node TYPE t_node_table,
w_node TYPE LINE OF t_node_table.
START-OF-SELECTION.
CALL SCREEN 9000.
*& Module status_9000 OUTPUT
text
MODULE status_9000 OUTPUT.
SET PF-STATUS '9000'.
ENDMODULE. " status_9000 OUTPUT
*& Module user_command_9000 INPUT
text
MODULE user_command_9000 INPUT.
CASE sy-ucomm .
WHEN 'BACK' OR 'EXIT'.
SET SCREEN 0.
LEAVE SCREEN.
ENDCASE.
ENDMODULE. " user_command_9000 INPUT
*& Module init_9000 OUTPUT
text
MODULE init_9000 OUTPUT.
DATA: lw_sbook TYPE t_sbook.
SELECT customid fldate bookid FROM sbook
INTO TABLE i_sbook WHERE customid IN s_custid.
SORT i_sbook BY customid ASCENDING.
CREATE OBJECT o_custom_container
EXPORTING
container_name = 'TREE'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc <> 0.
MESSAGE 'Error Creating Container' TYPE 'E'.
ENDIF.
CREATE OBJECT o_tree
EXPORTING
parent = o_custom_container
node_selection_mode =
cl_gui_simple_tree=>node_sel_mode_single
EXCEPTIONS
lifetime_error = 1
cntl_system_error = 2
create_error = 3
failed = 4
illegal_node_selection_mode = 5.
IF sy-subrc <> 0.
MESSAGE 'Error Creating Tree' TYPE 'E'.
ENDIF.
Add ROOT Folder
CLEAR w_node.
w_node-node_key = 'ROOT'.
w_node-text = 'Root'.
w_node-isfolder = 'X'.
APPEND w_node TO i_node.
CLEAR lw_sbook .
LOOP AT i_sbook INTO w_sbook.
IF lw_sbook-customid NE w_sbook-customid.
lw_sbook-customid = w_sbook-customid.
CLEAR w_node.
w_node-node_key = w_sbook-customid.
w_node-text = w_sbook-customid.
w_node-relatkey = 'ROOT'.
w_node-relatship = cl_gui_simple_tree=>relat_last_child.
w_node-isfolder = 'X'.
APPEND w_node TO i_node.
ENDIF.
CLEAR w_node.
w_node-node_key = w_sbook-bookid.
w_node-relatkey = w_sbook-customid.
w_node-relatship = cl_gui_simple_tree=>relat_last_child.
w_node-text = w_sbook-bookid.
<b> w_node-n_image = icon_customer.</b>
APPEND w_node TO i_node.
ENDLOOP.
CALL METHOD o_tree->add_nodes
EXPORTING
table_structure_name = 'TRSTREE'
node_table = i_node
EXCEPTIONS
failed = 1
error_in_node_table = 2
dp_error = 3
table_structure_name_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE 'Error Adding Node to Tree' TYPE 'E'.
ENDIF.
Expand tree
CALL METHOD o_tree->expand_root_nodes
EXPORTING
level_count = 2
expand_subtree = ' '
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE 'Error Expanding Tree' TYPE 'E'.
ENDIF.
ENDMODULE. " init_9000 OUTPUT
Regards
Kathirvel -
Tree view control - populating speed - over 100 nodes
I have a few questions about a tree view control:
1. If you put more than approximately 100 nodes in a tree, it populates too slow. There is no change if you try with query or record group. I figured that the populating of the record group makes all problems, but there is no chance to enlarge the array siye of the record group. Developer 6 has some built-ins which can do that, bu after many unsuccesful tries I don't see a solution.
I tried to make fetches from cursor into a record group (30 nodes on a "page", but it looses a real hierarchy and you should do a lot of programming). If anybody knows how to make the population of the tree faster or have some template / please forward.
2. After we put the patch 5 of developer6, tree view control is totally unpredictable. Usually its when you programmaticaly try to select a node (ftree.set_tree_selection)...Anybody have the same problems?<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Natasa Stojovska ([email protected]):
I have a few questions about a tree view control:
1. If you put more than approximately 100 nodes in a tree, it populates too slow. There is no change if you try with query or record group. I figured that the populating of the record group makes all problems, but there is no chance to enlarge the array siye of the record group. Developer 6 has some built-ins which can do that, bu after many unsuccesful tries I don't see a solution.
I tried to make fetches from cursor into a record group (30 nodes on a "page", but it looses a real hierarchy and you should do a lot of programming). If anybody knows how to make the population of the tree faster or have some template / please forward.
<HR></BLOCKQUOTE>
Try taking out the 'start with' and 'connect by' clauses in your select statement if you're using them. However, this will mean that you will have to determine the levels of the tree manually and ensure that the data comes out in the same order each time you execute the select statement.
null -
How to add Icon in Tree View in Forms 6.0 (URGENT..!)
Hello All,
I want to add icons in tree view (hierarchical tree) by using
forms 6.0.
So pls. help me to find out the solution for the same.
thanks
Pradeep
nullPradeep (guest) wrote:
: Hello All,
: I want to add icons in tree view (hierarchical tree) by using
: forms 6.0.
: So pls. help me to find out the solution for the same.
: thanks
: Pradeep
hello pradeep,
for adding icons in the tree, u willhave to look closely to the
data format for the tree.in the data format used for populating
the tree we are supplying 5 fields. the state of the tree node
(expanded or collapsed), the depth of the node w.r.t the parent
node, the node value, the node label(what we see on the tree)
and the node icon which we want to use. for the node icon we
have to provide the entire path of the icon file. that's it.
hope this will solve the problem
null -
Hi all
I want to set a print option for the tree view control along with back,exit etc options.please help me to do this.
Thanks in regards
Regards
Giri<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Natasa Stojovska ([email protected]):
I have a few questions about a tree view control:
1. If you put more than approximately 100 nodes in a tree, it populates too slow. There is no change if you try with query or record group. I figured that the populating of the record group makes all problems, but there is no chance to enlarge the array siye of the record group. Developer 6 has some built-ins which can do that, bu after many unsuccesful tries I don't see a solution.
I tried to make fetches from cursor into a record group (30 nodes on a "page", but it looses a real hierarchy and you should do a lot of programming). If anybody knows how to make the population of the tree faster or have some template / please forward.
<HR></BLOCKQUOTE>
Try taking out the 'start with' and 'connect by' clauses in your select statement if you're using them. However, this will mean that you will have to determine the levels of the tree manually and ensure that the data comes out in the same order each time you execute the select statement.
null -
How to handle tree view control in business one ui sdk
Hi,
Can any guide me on how to handle tree view control in business one ui sdk?
Thanking in advance.
With Regards,
Ram.Hi Ram,
Nowadays there are some trouble with the treeview controls in Windows XP SP2 as you can see here:
It is said that SAP will publish a treeview control in 2005 SP1.
Hope helps,
Ibai Peñ -
Expand=false for Tree view control
Hi
I have a placed a tree view control on SharePoint 2010 master page and given sitemap as a datasource.
and my tree view is displaying all the links from sitemap file.
But here the problem is all the node are getting expanded.
Is there any way to disable that.Assuming you are using SPTreeview control you can set ExpandDepth property. This property gets or sets the number of levels that are expanded when a TreeView control is displayed for the first time.
Example: http://msdn.microsoft.com/en-us/library/ms466994(v=office.14).aspx
Amit -
Hello,
(LabVIEW 8.0): I have found that the font size of the tree view items can be set at design time from the drop down list on the menu bar. However, is it possible to make each "level" (i.e. parent = a level, child = different level, grandchild = still another level) have a different font size to clearly differentiate one level from the next?
Thanks,
Christry a property node...
Attachments:
Clipboard-2.jpg 76 KB -
Dear All,
how can i display the icon in tree view .
Thanks...You have to post in forms forum.
Forms -
JSF tree view GUI component and tree node actions
Hi,
I am new in using JSF and have a problem with my simple test application.
The application contains a tree view control with one static tree node and a separate text area. Clicking on the tree node shall fill the text area with the string 'hello'. Seems to be very simple, but it doesn't work.
What did I do?
First of all I use the Sun Java Studio Creator 2.
By double clicking on the tree node in the design window of the IDE a method called treeNode1_action() was created. I also added the String text to the session bean. treeNode1_Action() does not more than setting text='hello' ( getSessionBean().setText('hello'); ).
The jsp file contains the line
<ui:textArea binding="#{Page1.textArea}" id="textArea" style="height: 192px; left: 360px; top: 48px; position: absolute; width: 456px" text="#{SessionBean1.text}"/>, so the text of the text area is bound to the session property 'text'.
Running the application and clicking on the tree node does nothing except reloading the page (no 'hello' inside the text area).
Using the debugger showed me that the bean property text is set correctly to 'hello', also after reloading the page.
What did I do wrong?
What do I have to do to display 'hello' in the text area?
I would be glad for some good advice to solve my problem and looking forward for an answer.
Regards from germany
Matthiaswant to remove the green patch from the jsf tree componentas u said ,, it is COMPONENET so this is a pre-made creator component that u cant chnage its attributes ,,
instead u can extract Theam.jar file and change the icons ,, u i didnt do it before ,, but u may be find what u want there,
hope this will help
good luck
Mohammed -
Tree view display along with icons
Hi all
Anybody please give me the complete code to display the tree view which takes input from selection screen.I also need to display icons in the tree view.please help its urgent.
Thank you.
Regards
GiriHi giri ,
Chk this program SAPSIMPLE_TREE_CONTROL_DEMO
Displaying icon in tree view -
How to blick tree view few specific nodes
here i got a code which show how to blink tree view node but i am confuse that how to blink few node.
Answered by:
Avatar of Tamer Oz
20,185
Points
Top 0.5
Tamer Oz
Partner Joined Sep 2009
2
8
17
Tamer Oz's threads
Show activity
Treeview control - How to make a node blink?
Visual Studio Languages
.NET Framework
>
Visual C#
Question
Alert me
Question
Vote as helpful
0
Vote
Hi,
Is there a "elegant" way to make blink a treeview node?
I am thinking to use a timer with the collection of nodes that I want to make the blink effect, and update the icon ...
Friday, November 06, 2009 6:19 PM
Reply
|
Quote
|
Report as abuse
Avatar of Kikeman
Kikeman
R. BOSCH
105 Points
All replies
Question
Vote as helpful
0
Vote
Hi,
You can develop your custom control for this purpose. The logic you mentioned was correct. Here is a sample control that I developed by the logic you mentioned.
public class BlinkingTreeView : TreeView
private Timer t = new Timer();
private List<TreeNode> blinkingNodes = new List<TreeNode>();
public BlinkingTreeView()
t.Interval = 1000;
t.Tick += new EventHandler(t_Tick);
bool isNodeBlinked = false;
void t_Tick(object sender, EventArgs e)
foreach (TreeNode tn in blinkingNodes)
if (isNodeBlinked)
//update Icon
tn.Text = tn.Text.Substring(0, tn.Text.Length - 1);//to test
isNodeBlinked = false;
else
//update Icon
tn.Text = tn.Text + "*";//to test
isNodeBlinked = true;
public void AddBlinkNode(TreeNode n)
blinkingNodes.Add(n);
public void RemoveBlinkNode(TreeNode n)
blinkingNodes.Remove(n);
public void ClearBlinkNodes()
blinkingNodes.Clear();
public List<TreeNode> BlinkingNodes
get { return blinkingNodes; }
public int BlinkInterval
get { return t.Interval; }
set { t.Interval = value; }
public void StartBlinking()
isNodeBlinked = false;
t.Enabled = true;
public void StopBlinking()
t.Enabled = false;
just show me how to use BlinkingTreeView class. i will have tree view which will have few node and few nodes may have few child nodes. now how to achieve by this class BlinkingTreeView and show me how to blink few specific node not all. thanksbetter to come with code. first populate tree view with some dummy node this way
Root
Child1
Child1-sub1
Child1-sub2
Child2
Child2-sub1
Child2-sub2
now blink Child1-sub2 & Child2-sub1. please come with code. thanks -
Tree view not displaying labels
Hi,
I am trying to use the Tree component, the tree view part is
fine I can click on a folder and it expands click on the icon and
it runs the preloader (component) and displays to pic fine. What it
doesn’t do is display the text next to the folder or icon it
is just blank. I have even tried copying the gallery_tree.fla (from
\Flash 8\Samples and Tutorials\Samples\ActionScript\Galleries) and
putting it in to my project with the same problem. So below are the
xml file and the action script.
Any help is appreciated
BP
Note: I am trying to use this in _root.blank_mc.menu3 (which
is a movie clip)
XML file
<?xml version="1.0"?>
<tree>
<node label='Gallery 1'>
<node label='DCP_0730' src="images/DCP_0730.jpg" />
<node label='DCP_0731' src="images/DCP_0731.jpg" />
<node label="DCP_0732" src="images/DCP_0732.jpg" />
<node label="DCP_0733" src="images/DCP_0733.jpg" />
<node label="DCP_0734" src="images/DCP_0734.jpg" />
<node label="DCP_0735" src="images/DCP_0735.jpg" />
<node label="DCP_0736" src="images/DCP_0736.jpg" />
<node label="DCP_0737" src="images/DCP_0737.jpg" />
<node label="DCP_0738" src="images/DCP_0738.jpg" />
<node label="DCP_0739" src="images/DCP_0739.jpg" />
<node label="DCP_0740" src="images/DCP_0740.jpg" />
<node label="DCP_0741" src="images/DCP_0741.jpg" />
<node label="DCP_0742" src="images/DCP_0742.jpg" />
<node label="DCP_0743" src="images/DCP_0743.jpg" />
<node label="DCP_0744" src="images/DCP_0744.jpg" />
<node label="DCP_0745" src="images/DCP_0745.jpg" />
<node label="DCP_0746" src="images/DCP_0746.jpg" />
<node label="DCP_0747" src="images/DCP_0747.jpg" />
</node>
</tree>
Action scriptanyone out there with any sugestions? the problem is in the
action script because it works on the mail time line but not in
_root.blank_mc.menu3 which is were I need it.
Action script below
var my_pb:mx.controls.ProgressBar;
var my_ldr:mx.controls.Loader;
var my_tree:mx.controls.Tree;
my_pb._visible = false;
my_pb.indeterminate = true;
my_pb.setSize(160, 30);
my_pb.source = my_ldr;
my_pb.mode = "polled";
var pbListener
bject = new Object();
pbListener.complete = function(evt
bject) {
evt.target._visible = false;
my_pb.addEventListener("complete", pbListener);
var treeDP_xml:XML = new XML();
treeDP_xml.ignoreWhite = true;
treeDP_xml.onLoad = function(success:Boolean) {
if (success) {
my_tree.dataProvider = this.firstChild;
treeDP_xml.load("gallery_tree.xml");
var treeListener
bject = new Object();
treeListener.change = function(evt
bject) {
var treeNode:XMLNode = evt.target.selectedItem;
if (treeNode.attributes.src != undefined) {
my_pb._visible = true;
my_ldr.load(treeNode.attributes.src);
my_tree.addEventListener("change",treeListener);
stop(); -
I have a HTML page with an IFrame. Inside the Iframe there is a table with a tree view
<iframe>
<table>
<tr>
<td>
<treeview id="tv1"></treeview>
</td>
</tr>
</table>
</iframe>
In UIA, i am able to traverse till the tree view but not able to see it.
I have used the TreeWalker.RawViewWalker Field to traverse the node from the desktop Automation.RootElement.
I tried to use AutomationElement.FromPoint method to check whether i am able to get that element. Fortunately i was able to get the automation element.
i tried to get the path to root element from the node element using the TreeWalker.RawViewWalker. I was able to get the parent path to the root element.
But trying the reverse way like navigating from root element to tree node, was not getting the element for me.
Please help me with suggestions or inputs to resolve this issue.Thanks Bernard,
It works fine with JInitiator but not working with
the JPI. For JPI what settings I need to do ??hi TKARIM and Bernard, i am having similar problem even with the Bernard's recommended setup. could you post the webutiljini.htm (i presume you are using config=test) ?
i am actually using jinitiator 1.3.1.28 with Oracle HTTP Server of OAS 10gR2) calling Forms Server 6i (f60cgi). After setting up according to Bernard's recommended setup steps, the java console showed that it loaded the icon jar file when it could not read the form, but it skipped the loading of the icon jar file once it read and started the form. How do we specify in the form to pick up the icon from the jar file instead from a directory ? Or do we need to specify ? Any ideas ?
Thx and Regards
dkklau -
Build XML for Custom Nested Accordian (like Tree View Structure) for SharePoint List Data
Expected output in Xml:
<?xml version="1.0" encoding="utf-8" ?>
- <TopRoot>
- <Root id="1" Name="Department">
- <Type id="2" Name="IT">
- <SubType id="3" Name="Technology">
<SubSubType id="4" Name="Sharepoint" />
<SubSubType id="5" Name="ASP.NET" />
<SubSubType id="6" Name="HTML 5" />
</SubType>
</Type>
</Root>
</TopRoot>
List Details:
list details for storing category / sub category data and code to build tree structure for the same.
1.Create Custom List named “CategoryDetails”:
2.Create Column “Category Name” of type single line of text. Make it as required field and check Yes for Enforce Unique values.
3.Create column “Parent Category” of type lookup. under Additional Column Settings.
Get information dropdown, select “CategoryDetails”.
4.Choice column ["SRTypeName"] 1.Root,2.SRTYPE,3.SubSRTYPE, 4.SUBSUBSRTYPE
In this column dropdown, select “Category Name”:
Referance:
http://www.codeproject.com/Tips/627580/Build-Tree-View-Structure-for-SharePoint-List-Data -fine but don't want tree view just generate xml string
i just follwed above link it work perferfectly fine for building tree view but i don't want server control.
Expected Result:
My ultimate goal is to generate xml string like above format without building tree view.
I want to generate xml using web service and using xml i could convert into nested Tree View Accordian in html.
I developed some code but its not working to generate xml /string.
My modified Code:
public const string DYNAMIC_CAML_QUERY =
"<Where><IsNull><FieldRef Name='{0}' /></IsNull></Where>";
public const string DYNAMIC_CAML_QUERY_GET_CHILD_NODE =
"<Where><Eq><FieldRef Name='{0}' /><Value Type='LookupMulti'>{1}</Value></Eq></Where>";
protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
string TreeViewStr= BuildTree();
Literal1.Text = TreeViewStr;
StringBuilder sbRoot= new StringBuilder();
protected string BuildTree()
SPList TasksList;
SPQuery objSPQuery;
StringBuilder Query = new StringBuilder();
SPListItemCollection objItems;
string DisplayColumn = string.Empty;
string Title = string.Empty;
string[] valueArray = null;
try
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
using (SPWeb web = site.OpenWeb())
TasksList = SPContext.Current.Web.Lists["Service"];
if (TasksList != null)
objSPQuery = new SPQuery();
Query.Append(String.Format(DYNAMIC_CAML_QUERY, "Parent_x0020_Service_x0020_Id"));
objSPQuery.Query = Query.ToString();
objItems = TasksList.GetItems(objSPQuery);
if (objItems != null && objItems.Count > 0)
foreach (SPListItem objItem in objItems)
DisplayColumn = Convert.ToString(objItem["Title"]);
Title = Convert.ToString(objItem["Title"]);
int rootId=objItem["ID"].ToString();
sbRoot.Append("<Root id="+rootId+"
Name="+Title+">");
string SRAndSUBSRTpe = CreateTree(Title, valueArray,
null, DisplayColumn, objItem["ID"].ToString());
sbRoot.Append(SRAndSUBSRTpe);
SRType.Clear();//make SRType Empty
strhtml.Clear();
SRType.Append("</Root>");
catch (Exception ex)
throw ex;
return SRType.ToString();
StringBuilder strhtml = new StringBuilder();
private string CreateTree(string RootNode, string[] valueArray,
List<SPListItem> objNodeCollection, string DisplayValue, string KeyValue)
try
strhtml.Appends(GetSRType(KeyValue, valueArray, objNodeCollection);
catch (Exception ex)
throw ex;
return strhtml;
StringBuilder SRType = new StringBuilder();
private string GetSRType(string RootNode,
string[] valueArray, List<SPListItem> objListItemColn)
SPQuery objSPQuery;
SPListItemCollection objItems = null;
List<SPListItem> objNodeListItems = new List<SPListItem>();
objSPQuery = new SPQuery();
string objNodeTitle = string.Empty;
string objLookupColumn = string.Empty;
StringBuilder Query = new StringBuilder();
SPList objTaskList;
SPField spField;
string objKeyColumn;
string SrTypeCategory;
try
objTaskList = SPContext.Current.Web.Lists["Service"];
objLookupColumn = "Parent_x0020_Service_x0020_Id";//objTreeViewControlField.ParentLookup;
Query.Append(String.Format
(DYNAMIC_CAML_QUERY_GET_CHILD_NODE, objLookupColumn, RootNode));
objSPQuery.Query = Query.ToString();
objItems = objTaskList.GetItems(objSPQuery);
foreach (SPListItem objItem in objItems)
objNodeListItems.Add(objItem);
if (objNodeListItems != null && objNodeListItems.Count > 0)
foreach (SPListItem objItem in objNodeListItems)
RootNode = Convert.ToString(objItem["Title"]);
objKeyColumn = Convert.ToString(objItem["ID"]);
objNodeTitle = Convert.ToString(objItem["Title"]);
SrTypeCategory= Convert.ToString(objItem["SRTypeName"]);
if(SrTypeCategory =="SRtYpe")
SRType.Append("<Type id="+objKeyColumn+" Name="+RootNode+ ">");
if (!String.IsNullOrEmpty(objNodeTitle))
SRType.Append(GetSRType(objKeyColumn, valueArray, objListItemColn));
if(SrTypeCategory =="SRSubTYpe")
SRType.Append("<SRSubType id="+objKeyColumn+" Name="+RootNode+
">");
if (!String.IsNullOrEmpty(objNodeTitle))
SRType.Append(GetSRType(objKeyColumn, valueArray, objListItemColn));
if(SrTypeCategory =="SubSubTYpe")
SRType.Append("<SubSubType id="+objKeyColumn+" Name="+RootNode +"
></SubSubType");
SRType.Append("</SubType>");
SRType.Append("</Type>");
catch (Exception ex)
throw ex;
return SRType.ToString();
// Call method again (recursion) to get the child itemsHi,
According to your post, my understanding is that you want to custom action for context menu in "Site Content and Structure" in SharePoint 2010.
In "SiteManager.aspx", SharePoint use MenuItemTemplate class which represent a control that creates an item in a drop-down menu.
For example, to create or delete the ECB menu for a list item in
"Site Content and Structure", we can follow the steps below:
To add the “My Like” menu, we can add the code below:
<SharePoint:MenuItemTemplate
UseShortId=false
id="OLListItemLike"
runat="server"
Text="My Like"
ImageUrl="/_layouts/images/DelItem.gif"
ClientOnClickNavigateUrl="https://www.google.com.hk/"
/>
To remove the “Delete” menu, we can comment the code below:
<SharePoint:MenuItemTemplate
UseShortId=false
id="OLListItemDelete"
runat="server"
Text="<%$Resources:cms,SmtDelete%>"
ImageUrl="/_layouts/images/DelItem.gif"
ClientOnClickScript="%SmtObjectDeleteScript%"
/>
The result is as below:
More information:
MenuItemTemplate Class (Microsoft.SharePoint.WebControls)
MenuItemTemplate.ClientOnClickScript property (Microsoft.SharePoint.WebControls)
Best Regards,
Linda Li
Linda Li
TechNet Community Support
Maybe you are looking for
-
Ordered the Airport Extreme Base Station - some questions if you can help?
I have a Windows 7 Home Premium 64 bit IBM ThinkPad T500 laptop I need to connect, and a Windows Vista PC. The ThinkPad has a built-in wirless N card and the Vista has a Belkin N+ USB wireless adapter. Can these both find and connect to the Airport w
-
ALV GRID Using FM : Total,Avg,Avg/MT
Hi Forum, I have gone through several posts on sum,avg in alv but could not find exactly what i'm looking for so here its goes: BILL BAG MT MRP Retension TAXABLE VALUE BILL VALUE 1 20 1 200 4000
-
Query to get the hierarchical results
Hi, Please help me in writing a Query to get the hierarchical results. I want a result like follows... course-----groupname---TotalMembers---NotStarted---INProgress---Completed Course1---country1--------12---------------6----------3-------------3 Cou
-
Printed margins are bigger than it is viewed in adobe reader
Hi all: I convert some html pages to pdf with acrobat x pro, then I crop those margins to a small size, it looks fine in adobe reader , but when I print the pdf out , the margins of left and right are much bigger so that the font size is so small
-
HT5219 can i connect thunderbolt display to macpro
can i connect thunderbolt display to macpro i tried alot but its not supporting