[SOLVED] Aldeed:tabular with Meteor v3

Hello,
Do you know if there is a version of aldeed:tabular compatible with v3 ?

For example when we define selector :

new Tabular.Table({
  selector(userId) {
    return { documentOwner: userId };
  }
});

we need the library to await the selector function in order to do async server code

new Tabular.Table({
  selector: async function(userId) {
    if (!(await Roles.userIsInRoleAsync('admin'))) {
     return { documentOwner: userId };
    }
    return {}
  }
});

Has anyone been able to make it work ?

@jkuester will know the details.

Hey @dokithonon ,

I’m pretty sure what’s in master is updated for v3. I’m not sure if Jan got around to making the releases but you could grab it and add it as a local package to try it out if you’re in a hurry.

Indeed, the latest release is 3.0.0-rc.0 which still targets 3.0-rc.4. I will publish an updated release now, targeting 3.0

Edit:

1 Like

By the way @dokithonon unless you use SSR you or are strictly required to be isomorphic, you can still use Roles.userIsInRole when being on the client. cc @storyteller

1 Like

Thanks for your answers. I will try your updated package in the coming days and let you know my progress.

Hello,
I have an Meteor v2.16 app
I have installed aldeed:tabular@3.0.0-rc.1!

I have defined a code for client side and a code for server side

On the client I define my selector like this :

selector: function(userId) { ... }

On the server I define my selector like this :

selector: async function(userId) { ... }

This results in not showing anything in my tables :

It shows the rows, but all cells are empty

I20240902-19:58:27.013(2)? Exception in onStop callback: TypeError: handle.then is not a function
I20240902-19:58:27.014(2)?     at Subscription.<anonymous> (packages/aldeed:tabular/server/main.js:231:13)
I20240902-19:58:27.014(2)?     at runWithEnvironment (packages/meteor.js:1486:24)
I20240902-19:58:27.014(2)?     at packages/meteor.js:1499:14
I20240902-19:58:27.014(2)?     at packages/ddp-server/livedata_server.js:1286:7
I20240902-19:58:27.014(2)?     at Array.forEach (<anonymous>)
I20240902-19:58:27.014(2)?     at Function._.each._.forEach (packages/underscore.js:139:11)
I20240902-19:58:27.014(2)?     at Subscription._callStopCallbacks (packages/ddp-server/livedata_server.js:1285:7)
I20240902-19:58:27.014(2)?     at Subscription._deactivate (packages/ddp-server/livedata_server.js:1275:10)
I20240902-19:58:27.014(2)?     at Subscription.subscriptionProto._deactivate (packages/montiapm:agent/lib/hijack/wrap_subscription.js:85:24)
I20240902-19:58:27.014(2)?     at packages/ddp-server/livedata_server.js:1007:11
I20240902-19:58:27.014(2)?     at Map.forEach (<anonymous>)
I20240902-19:58:27.014(2)?     at Session._deactivateAllSubscriptions (packages/ddp-server/livedata_server.js:1006:21)
I20240902-19:58:27.014(2)?     at packages/ddp-server/livedata_server.js:530:12
I20240902-19:58:27.014(2)?     at packages/meteor.js:365:18
I20240902-19:58:27.014(2)?     at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1389:31)
I20240902-19:58:27.014(2)?     at packages/meteor.js:613:25

Do you know what I am doing wrong ?

I have create a Meteor v3 repo to test datatable

The second row should not be visible because it is not in the selector on the server side
If I remove the async word on the server side it works but I need the selector function to be async

Do you know what is wrong ?

I did this : Migration/3.0 by jankapunkt · Pull Request #459 · Meteor-Community-Packages/meteor-tabular · GitHub and it seems to work but I am not really sure of what I am doing…

1 Like

@jkuester thanks for accepting the modification. I still have this error :

Exception in onStop callback: TypeError: handle.then is not a function at Subscription.<anonymous> (packages/aldeed:tabular/server/main.js:231:13)

Do you know where this can come from ?

I think I found the problem.

My pull request : Migration/3.0 - observeChangesAsync by dokithonon · Pull Request #462 · Meteor-Community-Packages/meteor-tabular · GitHub

Solved with this version : aldeed:tabular@3.0.0-rc.3!

Thanks a lot for your reactivity @jkuester