duplicate button in multiple instances
hans-vb opened this issue · 3 comments
hans-vb commented
Hi, i need help with this:
http://neokoenig.github.io/jQuery-gridmanager/demo/multiple.html
In this demo you can view duplicate buttons, any solution for this issue?
neokoenig commented
hmm. Good catch, definitely a bug. Haven't got an immediate solution
neokoenig commented
Temporary hack/fix: change the initDefaultButtons function to include gm.options.customControls.global_col=[];
before it fires.
gm.initDefaultButtons = function(){
gm.log("+ InitDefault Buttons");
/* Bit of hack to make sure this is only run once */
gm.options.customControls.global_col=[];
if(gm.options.colSelectEnabled) {
gm.options.customControls.global_col.push({callback: gm.selectColClick, loc: 'top', iconClass: 'fa fa-square-o', title: 'Select Column'});
}
if(gm.options.editableRegionEnabled) {
gm.options.customControls.global_col.push({callback: gm.addEditableAreaClick, loc: 'top', iconClass: 'fa fa-edit', title: 'Add Editable Region'});
}
};
madc commented
The issue exists, because customControls somehow shared between different instances and not propperly reset. Another workaround without editing the core files would be to set global_col
with an empty array when initializing.
$('...').gridmanager({
customControls: {
global_col: []
},
})
Btw, the issue still exists, so i think it shouldn't be closed.