Epistemologist Epistemologist - 1 year ago 201
Javascript Question

vue js event after rending is done

I have a table that is rendered by Vue. I want to apply datatable on it after it is rendered. Reason I am using Vue first is because its requires lot of custom functionality on each cell.

Whenever I call datatable function on table I get an error because vue is not finished rendering table.

Is there any way to know when Vue is done rendering all elements in a dom so I can apply datatable on it.

Answer Source

Check out Vue.nextTick()

Here is a sample from the docs:

// modify data
vm.msg = 'Hello'
// DOM not updated yet
Vue.nextTick(function () {
  // DOM updated

Reference: http://vuejs.org/api/#Vue-nextTick

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download