Reloading a dhtmlxCombo from XML in scheduler lighbox

Hello,

First, thanks for all the help in the forum - you make great products and the assistance in the forums is very valuable.

I have a dhtmlxCombo that is loaded from XML in a dhtmlxScheduler custom details form. I also have a link that opens a popup window that allows the user to edit the details in the drop down, so I need to get the dhtmlxCombo XML to refresh once it’s updated. I’ve setup a function on the page that renders the scheduler to reload the combo box, and made the popup window call that function. The problem seems to be “getting at” the dhtmlxCombo drop down object. Normally, I think this would work by doing something like combo.clearAll(true);combo.loadXML(“xml”); but I’m not sure how to do this with the way the combo gets loaded in the scheduler. Any help is appreciated.

The dhtmlxScheduler setup for the combo looks like this (xxx are real values):

scheduler.form_blocks["combo"]={
    render:function(sns){
		var height=(sns.height||"23")+"px";
		var html="<div data='"+sns.xml+"' class='dhx_cal_ltext' style='height:"+height+";' id='"+scheduler.uid()+"'></div>";
		var html=html+"<div><a href=\"/customers/new\" onClick=\"window.open('xxx'); return false\">Create new customer</a></div>";
		return html;
    },
    set_value:function(node,value,ev){
		if (!node.combo){
                node.combo = new dhtmlXCombo(node.id,"dummy","553px");
				node.combo.enableFilteringMode(true);
                node.combo.loadXML("xxx",function(){node.combo.setComboValue(value||"");});
                return;
        }
        node.combo.setComboValue(value||"");
    },
    get_value:function(node,ev){
		return node.combo.getSelectedValue();
    },

    focus:function(node){
		node.combo.DOMelem_input.focus();
    }
}

Then I have my update function:

function updateCustomerCombo() {
customer.combo.clearAll(true);
customer.combo.loadXML("/customers.xml");
}

Which gets executed onLoad on the final page of the popup window flow by doing a window.opener.updateCustomerCombo().

Any help is appreciated. Thanks!

Chris

I figured out a way to do this, though I’m not sure it’s the right way. I created a global variable and set it to node.combo when I add the combo box, then I can just operate on it within the update function. If there is a better way, please let me know but this seems to work, even if it’s kludgy.

not sure that it is a better way, but it can be used if you have multiple combos in the form for example

var combo = document.getElementById(scheduler.config.lightbox.sections[INDEX].id).nextSibling.combo;

where INDEX - index of section in the config collection

If you have only one combo in the form - global variable may be a good solution as well.

By the way, combo will be initialized only when form is shown first time, so if form was never opened - object will not exists.