Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removeal of jQuery - how to bind grid? #2023

Open
InsidiousForce opened this issue May 27, 2021 · 7 comments
Open

Removeal of jQuery - how to bind grid? #2023

InsidiousForce opened this issue May 27, 2021 · 7 comments
Labels

Comments

@InsidiousForce
Copy link

Describe the problem your feature will solve.

I like that you are talking about removing jQuery. Great.

How do you bind to a dom node? Is this possible now?

$('#myGrid').w2grid({}) - replace this with what?

tried

const grid = new w2grid({});
const node = document.querySelector("#myGrid");
grid.render(node);

and a few other variants.

no dice.

@InsidiousForce
Copy link
Author

(I know you still need jQuery etc now, we don't use jQuery anywhere else and would like to use this "directly" not as a jQuery plugin)

@mpf82 mpf82 added the Question label May 27, 2021
@vitmalina
Copy link
Owner

vitmalina commented May 28, 2021

After evaluating the removal, it appears that it would not be as easy, nor do I think will bring much benefit. JQuery is a quality lib and it is very actively supported. Respect to jQuery team. At least query selector part of it (sizzle) is more advanced than css selectors). However, the effort is made to make w2ui ES6 native. Work is being done in this regard quite a bit.

Here is by the way an example how ES6 native w2ui will look like es6 example so it would look similar what you mentioned,

import '../libs/jquery/jquery-3.5.1.js'
import { w2grid } from 'w2ui.js'
import conf_grid from './conf-grid.js'

let grid = new w2grid(conf_grid)
grid.render(document.querySelectAll('#div'))

And yes, it is possible now. Just call render method and pass container to render in.

@vitmalina
Copy link
Owner

For 1.5.x version, here is a starter project that shows how to use it with ES6 modules w2ui-srater

@InsidiousForce
Copy link
Author

Ok will try your querySelectorAll example, I assume that's what you meant. I tried with the actual node I guess you're saying render() needs a nodelist and not a node/element. Will try that out next week. Thank you for the information.

@vitmalina
Copy link
Owner

It needs a node, not list, my bad. Please modify the code

@LucaGabi
Copy link

Removing jQuery is a bad decision that has in my opinion no reason.
Why remove jQuery ? I don't see a good reason ...

Better decoupling ui and data sources would be a good thing.

@mpf82
Copy link
Collaborator

mpf82 commented Jul 12, 2021

@LucaGabi removing JQuery is something that has been requested by some users over the past few years. But that does not mean it will happen anytime soon. As Vitali already pointed out, it would be a huge task with very little benefit.

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

No branches or pull requests

4 participants