Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jeremy on Oct 22, 2009 09:26
open dhtmlx forum
scheduler lightbox with combobox support

hi

I want to put comboboxes into the detail page of the scheduler. The following code works (except the setting of the values) but the drop down appears behind the popup. I know this as the page is shorter than the dropdown.

Is there anyway of bringing the dropdown to the front?

thanks

Jeremy

    scheduler.form_blocks["my_execs"]={
            render:function(sns){
                return "<div class='dhx_cal_ltext' style='height:70px;'>" +
                        "Exec 1 <select style='width:200px;' id='staff1' name='staff1'></select>" +
                        "<br/>" +
                        "Exec 2 <select style='width:200px;' id='staff2' name='staff2'></select>" +
                        "</div>";
            },
            set_value:function(node,value,ev){
                window.dhx_globalImgPath = "imgs/";

                
                var inps = node.getElementsByTagName("SELECT");
                
                dhtmlXComboFromSelect("staff1").enableFilteringMode(true, "combo.xml", true, true);
                dhtmlXComboFromSelect("staff2").enableFilteringMode(true, "combo.xml", true, true);
                
                inps[0].value=ev.person1 ||"";
                inps[1].value=ev.person2||"";    
            },
            get_value:function(node,ev){
                
                var inps = node.getElementsByTagName("SELECT");
                
                ev.person1 = inps[0].value;
                ev.person2 = inps[1].value;
                return ev.text;
            },
            focus:function(node){
                var a=node.childNodes[1]; a.select(); a.focus();
            }
        }
Answer posted by Alex (support) on Oct 23, 2009 01:46

 Hello,

to set value into the combo you should use combo API: setComboValue() method for example. Select doesn't exist after combo creation:

 set_value:function(node,value,ev){ 
  window.dhx_globalImgPath = "imgs/"; 
  var inps = node.getElementsByTagName("SELECT"); 
   
  var c1 = dhtmlXComboFromSelect("staff1");
  c1.enableFilteringMode(true, "combo.xml", true, true); 
  c1.setComboValue(ev.person1||"");
   
  var c2 = dhtmlXComboFromSelect("staff2");
  c2.enableFilteringMode(true, "combo.xml", true, true); 
  c2.setComboValue(ev.person2||"");  
  }, 

Try to inrease z-index of the combo list to show combo list above the details form (dhtmlxcombo.css):

.dhx_combo_list{
  z-index: 11000;



Answer posted by Jeremy on Oct 23, 2009 07:26

Hi

I had some troubles getting the values back out and also trying to recreate the details form

This seems to work though. The trick is to keep an array of the combo boxes

Jeremy

var ex = new Array();

scheduler.form_blocks["my_execs"]={

render:function(sns){

return "<div class='dhx_cal_ltext' style='height:70px;'>" +

"<select style='width:200px;' id='staff1' name='staff1'></select>" +

"<br/>" +

"<select style='width:200px;' id='staff2' name='staff2'></select>" +

"</div>";

},

set_value:function(node,value,ev){

if (ex.length < 1){

ex[0] = dhtmlXComboFromSelect("staff1");

ex[1] = dhtmlXComboFromSelect("staff2");

ex[0].enableFilteringMode(true, "xml.xml", true, true);

ex[1].enableFilteringMode(true, xml.xml", true, true);

}

ex[0].setComboValue(ev.person1||"");

ex[1].setComboValue(ev.person2||"");

},

get_value:function(node,ev){

ev.person1 = ex[0].getSelectedValue();

ev.person2 = ex[1].getSelectedValue();

return ev.text;

},

focus:function(node){

var a=node.childNodes[1]; a.select(); a.focus();

}

}

Answer posted by Alex (support) on Oct 23, 2009 08:40

There is an issue with focus method. Try to use the following:

focus:function(node){

    var a = ex[0].DOMelem_input;

    a.select();

   a.focus(); 

}

Answer posted by Benjamin on Oct 25, 2009 10:36
Is this working propably ???
May i see the xml.xml and would it also work with sql-statement?
Answer posted by jeremy on Oct 26, 2009 02:09

Hi

it is actually using a dynamic web page to serve the XML but I simplified it for the example. You need to match the XML in the file in the examples and how you do it is up to you. I serve it out of the database in XML then transform it into the right shape using XSL

The file is here http://dhtmlx.com/docs/products/dhtmlxCombo/samples/common/data.xml

 

Jeremyhttp://dhtmlx/dhtmlxCombo/samples/common/data.xml