Tree - Combobox as node

Hello,



is it possible to attach a comboxbox as node? i have a huge tree and want to let the user have a kind

of elegant possibility to filter the nodes. Okay, i can do this also outside, but by attaching it to a nod, it is very clear from

the ui perspective to what node, the filter corresponds.



Example:



A combobox beneath the Object node with possible Statuses:



Objects [STATUS]

|

----



Best regards, Stefan Riedel-Seifert

Hello,

you can place html elements into the tree. In case of xml loading:


                <![CDATA[

]]>


If you meant dhtmlxcombo, it can be initialized after xml loading as follows:

tree.loadXML(url,function(){
    combo = new dhtmlXCombo(“combo_zone”,“alfa”,200);
    combo.loadXML(combo_xml);
    combo.attachEvent(“onChange”,function(){
         /your code here/
    })
})

But tree doesn’t provide API for filtering. Possibly filtering can be executed by smartRefreshItem method.

tree.smartRefreshItem(itemId,url+"?combo_value="+combo.getActualValue());
Here url is path to server-side script that should returns the xml with necessary child nodes.


Hi,



the xml is well formed and looks good, but the display is corrupt and the combobox doesn’t load.



i could’nt find the error :frowning:.



 



Best Regards, Stefan



 



 






Please, check that dhtmlxcombo libraries are included. You can download the package here dhtmlx.com/docs/products/dht … _init.html


Regarding incorrect display - could you please provide the example of the xml, that you try to load, and code of tree initialization.


Hi,



the files are correctly bound: i can instantiate a separate combobox via:
<div id=combo_zone2 style=width:200px; height:30px;></div>



<script>


var z = new dhtmlXCombo("combo_zone2", "alfa2", 200); z.readonly(1); z.loadXML("../common/data.xml");

</script>


 


I can avoid the incorrect display by


 


  SPAN { font-family: "Arial monospaced for SAP"; font-size: 8pt; color: #000000; background: #FFFFFF; } .L0S33 { color: #4DA619; } <![CDATA[<div id=combo_own></div>]]>


 


but will get ann error on the page 'Object required'.


 


If i use  SPAN { font-family: "Arial monospaced for SAP"; font-size: 8pt; color: #000000; background: #FFFFFF; } .L1S52 { color: #0000FF; } <div id=combo_own> my xml looks like:

  <?xml version="1.0" encoding="utf-8" ?>
- <tree id="0" open="0">
- <item text="Own Objects" id="o" open="0">
  <item text="FR (Released) (1) <![CDATA[
]]>
" id="o~FR" child="1" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="IA (In work) (0)" id="o~IA" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="LO (Locked) (0)" id="o~LO" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="RS (Resubmission) (0)" id="o~RS" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="ZF (Release request) (0)" id="o~ZF" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="ZG (Rejected) (0)" id="o~ZG" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  </item>
- <item text="Shared objects" id="s" open="0">
  <item text="FR (Released) (0) " id="s~FR" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="IA (In work) (0)" id="s~IA" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="LO (Locked) (0)" id="s~LO" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="RS (Resubmission) (0)" id="s~RS" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="ZF (Release request) (0)" id="s~ZF" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="ZG (Rejected) (0)" id="s~ZG" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  </item>
  </tree>

But the display is incorrect and the javascript error is the same 'Object required'.


 


Best regards,


Stefan


 


 

i’ve changed the encoding to 

SPAN { font-family: "Arial monospaced for SAP"; font-size: 8pt; color: #000000; background: #FFFFFF; } .L1S32 { color: #3399FF; }

iso-8859-1 , but the same result


The provided xml isn’t correct. The correct one is


<?xml version="1.0" encoding="utf-8" ?>




<![CDATA[ FR (Released) (1)

]]>











<![CDATA[ FR (Released) (1)
]]>













… okay, misunderstanding from my side.



the code is



 

SPAN { font-family: "Arial monospaced for SAP"; font-size: 8pt; color: #000000; background: #FFFFFF; } .L3S32 { color: #7D9EC0; } .L3S33 { color: #009300; } .L3S50 { color: #00008B; }

                    tree.loadXML(“objects.xml?uname=<%=sy-uname%>”,function(){
                     combo = new dhtmlXCombo(“combo_own”,“alfa”,200);
                     combo.loadXML(combo.xml);
                     combo.attachEvent(“onChange”,function(){ })
                    })




the xml



 

  <?xml version="1.0" encoding="utf-8" ?>
- <tree id="0" open="0">
- <item text="Own Objects" id="o" open="0">
- <item id="o~FR" child="1" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif">
- <itemtext>
- <![CDATA[
  ]]>
  </itemtext>
  </item>
  <item text="IA (In work) (0)" id="o~IA" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="LO (Locked) (0)" id="o~LO" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="RS (Resubmission) (0)" id="o~RS" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="ZF (Release request) (0)" id="o~ZF" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="ZG (Rejected) (0)" id="o~ZG" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  </item>
- <item text="Shared objects" id="s" open="0">
  <item text="FR (Released) (0)" id="s~FR" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="IA (In work) (0)" id="s~IA" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="LO (Locked) (0)" id="s~LO" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="RS (Resubmission) (0)" id="s~RS" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="ZF (Release request) (0)" id="s~ZF" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  <item text="ZG (Rejected) (0)" id="s~ZG" child="0" im0="s_CLOFOL.gif" im1="s_OPFOLD.gif" />
  </item>
  </tree>

the combobox appears in tree, but without list entries and a javascript error: 'undefined' is null or not an object.


if i load the options via   SPAN { font-family: "Arial monospaced for SAP"; font-size: 8pt; color: #000000; background: #FFFFFF; } .L0S32 { color: #3399FF; }  combo.addOption([[1,1111],[2,2222],[3,3333],[4,4444],[5,5555]]);


 


all is fine.


 


If changed to combo.loadXML("combo.xml"); and now all is ok.