neokoenig / jQuery-gridmanager

A way of building rows and grids with built in editable regions; requires jQuery, jQueryUI, Bootstrap 3.x, & optional TinyMCE or CKEditor
http://neokoenig.github.io/jQuery-gridmanager/
461 stars 129 forks source link

Jquery GridManager when refresh page button control multiply gm.initDefaultButtons #87

Open khalildiouriadservio opened 8 years ago

khalildiouriadservio commented 8 years ago

I added a gridmanager (jquery) to my project angular2 using typescript in my ngAfterViewInit I added this

this.gm = jQuery("#content").gridmanager().data('gridmanager'); this.canvas = this.gm.$el.find("#" + this.gm.options.canvasId); this.gm.initGlobalCustomControls(); to init my grid, so when I navigate to open again my div where I have the grid the button Add Edittable Region multiply every time I navigate and come back to grid page I found that the button Add Edditable Refion multiplied

`gm.initDefaultButtons = function () {

        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'});
        }
    };`
neokoenig commented 8 years ago

I don't have much experience with Angular/Typescript, but you shouldn't need to call initGlobalCustomControls yourself;

var gm = jQuery("#mycanvas").gridmanager().data('gridmanager'); should initialize the grid and parse the content within the canvas;

khalildiouriadservio commented 8 years ago

even if I remove it ,I get always the same problem I need just to know how to configure gm.initDefaultButtons to avoid the multiplication of buttons