I try to create a menubutton in a formatter of a datagrid. This menubutton must be shown different options available for each row. In order to do this, I create only one menu and for buttons in each row I refer them to this menu, like this:
Menu<div id="mnuOpciones" data-options="onClick: onClickMnuOpciones">
<div id="mnuOpcionPropiedades" data-options="iconCls:'icon-sbs-propiedades'">Propiedades</div>
<div id="mnuOpcionObjetivo" data-options="iconCls:'icon-sbs-objetivo'">Objetivo</div>
<div id="mnuOpcionMuestreo" data-options="iconCls:'icon-sbs-quimica'">Muestreo</div>
</div>
Menubutton in formattervar btnId = btnOpcionesId + '_' + key;
var btn = '<a id="' + btnId + '" href="javascript:void(0)"></a>';
setTimeout(function(){
$('#' + btnId).menubutton({
iconCls: 'icon-sbs-engranaje',
menu: '#'+ mnuOpciones,
disabled: false,
plain: true,
onClick : function () {
onClickBtnOpciones (key, row);
}
});
}, 0);
return btn;
However, when i click in a menubutton after that the menu was opened to another menubutton in a different row, the menu of the current row, close immediately. Maybe the reason for this is because the menu is shared between buttons. Could you please give me a solution to this don't happen?
PS: In my case, I change the delay time to close the menu to a higger value that you have, approximately 1000 miliseconds. Maybe this also is affecting.