Table Inspector after loadData

Get help with using Metro 4 components
Post Reply
Fabrizio
Posts: 8
Joined: Mon Apr 15, 2019 10:54 am
Status: Offline

Table Inspector after loadData

Post by Fabrizio » Mon Apr 15, 2019 11:07 am

Hi,
After loading JSON data on TABLE, the TABLE INSPECTOR component does not contain anything until I press the RESET button...How can i refresh the Inspector panel?

Thx

User avatar
olton
Site Admin
Posts: 205
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Mon Apr 15, 2019 11:16 am

You can use methods: resetView() or _resetInspector() after data loading

Fabrizio
Posts: 8
Joined: Mon Apr 15, 2019 10:54 am
Status: Offline

Post by Fabrizio » Mon Apr 15, 2019 11:44 am

Thanks for the quick reply ... but it still doesn't work.

My code:

var dataSource = Metro.session.getItemPart('app', 'doc', '') + 'archive_' + Metro.storage.getItem('idut', '') + '.json';
var table = $("#tabellaARCHIVIO").data("table");

table.loadData(dataSource, true);
table.resetView();

User avatar
olton
Site Admin
Posts: 205
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Mon Apr 15, 2019 11:52 am

_resetInspector()

User avatar
olton
Site Admin
Posts: 205
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Mon Apr 15, 2019 11:57 am

Code from component

Code: Select all

inspector.on(Metro.events.click, ".js-table-inspector-reset", function(){
    that.resetView();
});

User avatar
olton
Site Admin
Posts: 205
Joined: Mon Apr 09, 2018 6:19 pm
Location: Kiev, Ukraine
Status: Offline

Post by olton » Mon Apr 15, 2019 12:02 pm

loadData is an async method, use attribute data-on-data-loaded to reset view after data loading

Fabrizio
Posts: 8
Joined: Mon Apr 15, 2019 10:54 am
Status: Offline

Post by Fabrizio » Mon Apr 15, 2019 12:19 pm

Many thank's

Post Reply