jQWidgets Forums

jQuery UI Widgets Forums Vue Issues with adding and deleting columns

This topic contains 3 replies, has 2 voices, and was last updated by  frosty 5 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • frosty
    Participant

    I need to delete a column from the grid based on end user action. I use below lines to delete the column. While the array element is deleted, UI does not reflect it even though the columns variable is bound as in sample app https://www.jqwidgets.com/vue/vue-grid/#https://www.jqwidgets.com/vue/vue-grid/vue-grid-editing.htm. Is there any additional steps I’m missing?

            let value = this.$refs.myGrid.getselectedcell();
            if(value)
                this.columns = this.columns.filter(c => c.datafield !== value.datafield);

    Similarly, grid does not refresh after adding a column using code below. Note that this.columns has the columns array like in sample program.

                let text = 'C' + (this.columns.length + 1);
    
                // Add new column to data
                this.source.datafields.push({ name: text, type: 'string', map: this.columns.length.toString() });
                this.source.localdata.forEach(e => e.push(''));
                this.dataAdapter = new jqx.dataAdapter(this.source);
    
                // Add new column to metadata
                this.columns.push({ text: text, columntype: 'textbox', datafield: text, width: 120 });
                this.$refs.myGrid.columns = this.columns;

    On debugging, I don’t see the JqxGrid component’s columns property changing at all. What am I missing here?


    Todor
    Participant

    Hello frosty,

    Please review the following example whether it fits your needs.

    Let us know if you need further assistance.

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com


    frosty
    Participant

    Works like a charm! Thank you


    frosty
    Participant

    In an editable grid any data entered in the grid is cleared after adding a column. Do I need to copy the data from grid and set a new dataAdapter before calling updatebounddata()?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.