1

Do we have any way to delete a column in dojox/grid/EnhancedGrid. Please let us know if there is any solution for this.

Please find my sample grid.
Details: it creates a dojox/grid/EnhancedGrid and has an action associated with clicking a header row. What action can I add to delete the column?

var dataStore = new ObjectStore({objectStore: objectStoreMemory});
// grid
grid = new EnhancedGrid({
    selectable: true,
    store: dataStore,
    structure : [ {
        name : "Country",
        field : "Country",
        width : "150px",
        reorderable: false,
        editable : true
    }, {
        name : "Abbreviation",
        field : "Abbreviation",
        width : "120px",
        reorderable: false,
        editable : true
    }, {
        name : "Capital",
        field : "Capital",
        width : "100%",
        reorderable: false,
        editable : true
    } ],
    rowSelector: '20px',
    plugins: {
        pagination: {
            pageSizes: ["10", "25", "50", "100"],
            description: true,
            sizeSwitch: true,
            pageStepper: true,
            gotoButton: true,
            maxPageStep: 5,
            position: "bottom"
        }
    },
    dodblclick: function() {
        alert("Header clicked");  
    }
}, "grid");
grid.startup();
mcgyver5
  • 1,153
  • 2
  • 15
  • 29
Ajay Kumar
  • 71
  • 8

1 Answers1

0

you need to use the method

grid.setStructure(newLayout); 

or

grid.set('structure',newLayout); 

here newLayout is the layout that you need to create without the columns that you need. Hope this helps.

bajji
  • 1,271
  • 3
  • 15
  • 37
  • Most of the click events are not working as expected in Dojo Enhancedgrid. If this is the case how to capture the event to know the column that need be deleted? – Ajay Kumar Jan 13 '18 at 03:49
  • can you please elaborate? maybe with an example – bajji Jan 16 '18 at 14:38