facebookarchive / fixed-data-table

A React table component designed to allow presenting thousands of rows of data.
http://facebook.github.io/fixed-data-table/
Other
4.3k stars 553 forks source link

Using Version 6 with new APIs. #374

Open fixedtablev6Update opened 8 years ago

fixedtablev6Update commented 8 years ago

Hi,

I have been looking into finding a way to migrate to 0.6 with new APIs, but originally we could not get it to work without creating our own fork. I just wanted to share this so others can benefit as well.

You do not need to create a separate fork to use the new APIs.

I debugged through the code to see how is it working and it looks like that “TransitionTable (Old Table)” has this API below. If “needsMigration” is true then it goes to the Old code, otherwise to new code.

Originally, I had not removed the old definitions at all in my Definition file, so “needsMigration” was always true – and hence even if I provided new cell code, it was not getting hit.

_checkDeprecations: function _checkDeprecations() {
 var needsMigration = false;
 if (this.props.rowGetter) {
 notifyDeprecated('rowGetter', 'Please use the cell API in Column to fetch data for your cells.');
** // ROWGETTER??? You need to migrate.
 needsMigration = true;**
 }….
 }

So, to use the new APIs - you need to delete all references to deprecated definitions (but mainly the rowGetter - as that is the only flag that causes needsMigration to be true/false).

Thanks.