Missing load in buttonCombo

Hi,

I noticed that there is no way to load the buttonCombo in a ribbon even though it is based on a combobox so I thought I might help others out who need the functionality as I did.

In dhtmlx.js you need to add a couple of lines.

Look for

remove:function(a){if(a.combo instanceof dhtmlXCombo){a.combo.unload();a.combo=null}},

and add

loadButtonCombo:function(a,c){if(a.combo instanceof dhtmlXCombo){a.combo.load(c);}},

just behind it. Then look for

dhtmlXRibbon.prototype.setValue=function(g,c){var a=this._items[g];if(this.items[a.type]&&typeof(this.items[a.type].setValue)=="function"){this.items[a.type].setValue(a,c)}};

and add

dhtmlXRibbon.prototype.loadButtonCombo=function(g,c){var a=this._items[g];if(this.items[a.type]&&typeof(this.items[a.type].loadButtonCombo)=="function"){this.items[a.type].loadButtonCombo(a,c)}};

just behind it.

Now you have:

myRibon.loadButtonCombo(“itemId”, “some URL goes here”);

The values can be in xml or json format. From here it is easy enough to prototype the callback as well.

Cheers,

Alex

Hi again,

I just made a minor, but important tweek.

It’s important to add clearAll otherwise the items just grows…

loadButtonCombo:function(a,c){if(a.combo instanceof dhtmlXCombo){a.combo.clearAll(true);a.combo.load(c);}},

Cheers,

Alex