Categories | Question details Back To List | ||
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 Answer posted by Alex (support) on Nov 05, 2009 00:29 Hello, you can place html elements into the tree. In case of xml loading: ... <item id="combo"> <itemtext><![CDATA[<div id="combo_zone" style="width:200px; height:30px;"></div>]]></itemtext> </item> ... 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. Answer posted by Stefan Riedel-Seifert on Nov 06, 2009 01:49 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 :-(.
Best Regards, Stefanhttp://dhtmlx.com/docs/products/kb/imgs/_button_post_answer.gif">
Attachments (2) Answer posted by Alex (support) on Nov 06, 2009 02:40 Please, check that dhtmlxcombo libraries are included. You can download the package here http://www.dhtmlx.com/docs/products/dhtmlxCombo/index.shtml The combo sample is http://www.dhtmlx.com/docs/products/dhtmlxCombo/samples/01_initialization/02_combo_init.html Regarding incorrect display - could you please provide the example of the xml, that you try to load, and code of tree initialization. Answer posted on Nov 06, 2009 02:59 Hi, the files are correctly bound: i can instantiate a separate combobox via: <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
<![CDATA[<div id=combo_own></div>]]>
but will get ann error on the page 'Object required'.
If i use <div id=combo_own></div> my xml looks like: <?xml version="1.0" encoding="utf-8" ?>
<item text="FR (Released) (1) <![CDATA[ <div id=combo_own></div> ]]>" 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="FR (Released) (0) <![CDATA[ <div id=combo_shared></div> ]]>" 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
Answer posted on Nov 06, 2009 03:02 i've changed the encoding to
iso-8859-1 , but the same result Answer posted by Alex (support) on Nov 06, 2009 03:31 The provided xml isn't correct. The correct one is <?xml version="1.0" encoding="utf-8" ?> Answer posted on Nov 06, 2009 05:07 ... okay, misunderstanding from my side. the code is
tree.loadXML("objects.xml?uname=<%=sy-uname%>",function(){ the xml
<?xml version="1.0" encoding="utf-8" ?>
<![CDATA[
<div id="combo_own" style="width:200px; height:30px;"></div>]]> </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="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 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.
|