Flexgrid - Vue 2- How to dynamically add columns?

Posted by: daryn.holmes on 30 October 2017, 1:52 am EST

    • Post Options:
    • Link

    Posted 30 October 2017, 1:52 am EST

    Hi,

    How can I dynamically create columns in the FlexGrid control.

    I tried to use this in the templates:

    <wj-flex-grid-column v-for="(col, index) in gridData.columns" :key="index"  binding="col" header="col"></wj-flex-grid-column>
    

    However that did not seem to work.

    The columns only show if I have auto-generate-columns set to true.

    Do you have any advice?

    Thanks, Daryn

  • Posted 30 October 2017, 10:28 pm EST

    Hi Daryn,

    You need to use “:” before binding so that it can evaluate the col value. Please refer to the following code snippet for the same.

    <wj-flex-grid :items-source="data">
           <wj-flex-grid-column  v-for="col in colDef" :key="col" :binding="col"></wj-flex-grid-column>
        </wj-flex-grid>
    

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels