'Async' Initialise Columns and table in data-table component?



  • New the both Vue and Quasar, so perhaps this is easy.

    I have a table which sets ‘table’ and ‘columns’ asynchronously as the view is ‘created’, and refreshes every couple of seconds.

    The problem is, before all this, I need to initialise ‘this.columns’ and ‘this.table’ in a synchronous manner, otherwise I see errors.

    I do this with dummy data, but it seems redundant.

    Any ideas? maybe I should just be happy with what I have (i.e. everything works, just not as nice as possible).



  • It looks like only ‘columns’ needs to be set on initialisation, rather than ‘table’, which is nicer



  • Yes, Vue requires the data object properties (in the data() function) to be available prior to rendering, so it knows what needs to be reactive. This explains why better.

    https://vuejs.org/v2/guide/reactivity.html

    This, for instance, allows for the dynamic alteration of the columns in the example data table. http://quasar-framework.org/components/data-table.html

    Scott


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.