Datatable from pivot

I am trying to get datatable from the pivot ui from the following syntax: var datatable = $$(“pivot”).$$(“data”);
But I am getting following error:

TypeError: $$(…) is undefined
var datatable = $$(“flight_pivot_table”).$$(“data”);

How to resolve this ?

You have the “id=‘flight_pivot_table’” in the pivot’s configuration, right ?
The above line works for me, as alternative you can use

var table = $$("flight_pivot_table").getChildViews()[1];