Skip to content

Conversation

jankapunkt
Copy link
Member

Everything that's left to get this package fully compatible with Meteor 3

@dokithonon
Copy link
Contributor

dokithonon commented Sep 2, 2024

My test repo that does not accept async selector function on the server : https://github.com/dokithonon/meteor-test-async

@dokithonon
Copy link
Contributor

It seems that changing this line 92 in server/main.js

const tableSelector = table.selector(this.userId);
to
const tableSelector = await table.selector(this.userId);

is sufficient to make it work.

What do you think ?

dokithonon and others added 3 commits September 2, 2024 21:11
By doing this we can use async function in the selector function on the server
await selector, allow, changeSelector & customSearch functions in case they are async.
@jankapunkt
Copy link
Member Author

jankapunkt commented Oct 14, 2024

@dokithonon @lynchem @ricaragao @p-wieser the latest rc (rc.4) now supports any datatables setup you want and does no hard-pinning anymore.

This is because, some might use dt + Bootstrap 3, other + Bootstrap 4 or 5 and others something entirely different.

Additionally: importing and initializing Datatables 2 is not working the way DT 1 does. In order to have everyhting worked out correctly, you need to first import Datatables, then "initialize" Tabular.

datatables.net 1.x
import Tabular from 'meteor/aldeed:tabular'
import { $ } from 'meteor/jquery';

// Bootstrap Theme
import dataTablesBootstrap from 'datatables.net-bs';
import 'datatables.net-bs/css/dataTables.bootstrap.css';

// Buttons Core
import dataTableButtons from 'datatables.net-buttons-bs';

// Import whichever buttons you are using
import columnVisibilityButton from 'datatables.net-buttons/js/buttons.colVis.js';
import html5ExportButtons from 'datatables.net-buttons/js/buttons.html5.js';
import flashExportButtons from 'datatables.net-buttons/js/buttons.flash.js';
import printButton from 'datatables.net-buttons/js/buttons.print.js';

// Then initialize everything you imported
dataTablesBootstrap(window, $);
dataTableButtons(window, $);
columnVisibilityButton(window, $);
html5ExportButtons(window, $);
flashExportButtons(window, $);
printButton(window, $);

Tabular.init() // no args
datatables.net >= 2.x

You need to have Meteor to recompile the packages:

{
  ...
  "meteor": {
    ...
    "nodeModules": {
      "recompile": {
        "datatables.net": ["client", "legacy"],
        "datatables.net-bs": ["client", "legacy"],
        "datatables.net-buttons": ["client", "legacy"],
        "datatables.net-buttons-bs": ["client", "legacy"]
      }
    }
  }
}
import Tabular from 'meteor/aldeed:tabular'

// Bootstrap Theme
import DataTables from  'datatables.net-bs';
import 'datatables.net-bs/css/dataTables.bootstrap.css';

// Buttons Core
import 'datatables.net-buttons-bs';
// Import whichever buttons you are using
import 'datatables.net-buttons/js/buttons.colVis.js';
import 'datatables.net-buttons/js/buttons.html5.js';
import 'datatables.net-buttons/js/buttons.print.js';

Tabular.init({ DataTables }) // pass DT constructor

Note, that this example may use different DT libraries than your setup needs.

@jankapunkt
Copy link
Member Author

jankapunkt commented Jul 18, 2025

@dokithonon @lynchem @ricaragao I added a minimal test suite using mtest (tests) and biome (lint/format) to move forward with more confidence and to quickly detect if things are breaking

Edit: note that for now lint/format is not active as this package would undergo another major revision due to lots of code still being es5. However - in midterm perspective and after finalizing a 3.0 release we can surely tackle lint/format

@lynchem
Copy link
Collaborator

lynchem commented Jul 21, 2025

Looks good @jankapunkt - I can't try it out though as we're still stuck back in Meteor 2.x.

I'm wondering if we should move away from tinytest altogether ? It's a bit alien to me - maybe we can quickly switch to jest? Is there any advantage (other than the existing tests) to tinytest ?

…fields-subdocuments

Adding the property extraFieldWithSubDocument
@ricaragao
Copy link
Member

@jankapunkt , can you publish the current RC?

@jankapunkt
Copy link
Member Author

Note that mtest is not working with Meteor 3 anymore which is why the test never succeeds...

@jankapunkt
Copy link
Member Author

published 3.0.0-rc.5 please give it a try and provide feedback here

@jankapunkt
Copy link
Member Author

@lynchem @ricaragao I moved the tests to use meteortesting:mocha so we can have CI but they are still failing. we should definitely add more tests that cover most functionality before going towards a full release

@lynchem
Copy link
Collaborator

lynchem commented Aug 12, 2025

published 3.0.0-rc.5 please give it a try and provide feedback here

Anychance you could publish a 2.x version too ? We're still stuck in 2.x world for the foreseeable.

I moved the tests to use meteortesting:mocha so we can have CI but they are still failing. we should definitely add more tests that cover most functionality before going towards a full release

Cool, thanks Jan. That should make them easier to maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants