Comments (11)
There is currently no easy way to solve this but here is what you can do (its ugly):
<template name='myCollapsible'>
<ul class="collapsible">
{{#each pendingMembers}}
{{> myLi}}
{{/each}}
</ul>
</template>
<template name='myLi'>
<li>
....
</li>
</template>
Template.myLi.rendered = function () {
$('.collapsible').collapsible();
}
Now every time it is updated it will run.
from materialize-meteor.
I've been struggling with a similar issue, but my collection loses it's "reactivity"(a change to the collection is no longer live) whenever I run $('.collapsible').collapsible();
. Seems to occur if it's run from the primary template or the nested (or myLi
). Any idea what I'm missing?
Template.downNodes.helpers({
nodes: function () {
alerts = SolarwindsAlerts.find({"node_status": "DOWN"});
return alerts
}
});
Template.nodeList.rendered = function () {
$('.collapsible').collapsible();
};
I've been digging for a solution - but haven't had much luck.
from materialize-meteor.
@ctaloi can you get me a repository with the issue? It would be much easier to figure out if I had something to work with. If not give me a bit.
@d0minikk sorry for taking over this thread. I am working on https://github.com/meteor-useraccounts/materialize so I am quite deep in this right now.
from materialize-meteor.
@Kestanous wish I could - but sorry, I can't.. I can probably put something together.... let me know, thank you !
from materialize-meteor.
@ctaloi I have to say I am impressed! Yes it is actually removing them from the DOM. Don't run collapsible from the code and add:
Template.nodeList.destroyed = function () {
console.log('no more')
};
Then in your browser console run: $('.collapsible').collapsible();
I need to think about this for a while. We may need to take this to the source.
from materialize-meteor.
@Kestanous You are correct.
Removed collapsible from the code, reloaded - then ran $('.collapsible').collapsible();
from browser console resulted in
> $('.collapsible').collapsible();
[Log] no more (downNodes.js, line 14)
Now what ?
from materialize-meteor.
Hey guys, creator of materialize here. we are looking in to ways to improve compatibility with Angular and Meteor. Will be monitoring this thread. Feel free to pitch ideas to make development with meteor/materialize easier.
from materialize-meteor.
@Dogfalo awesome to see you in Meteor land, thanks for stoping by!
I am not sure what is happening now, yet, but I do know it is removing elements from Blazes control. If I had to guess, and it is a guess, I blame this: https://github.com/Dogfalo/materialize/blob/master/js/collapsible.js#L18
from materialize-meteor.
@Dogfalo as a side note have you seen issue #15? We are going to need you or your teem to approve that at some point. Once implemented we will get your latest code in a Meteor ready way without anyone doing any work!
from materialize-meteor.
@Dogfalo , Welcome on meteor.
The main topic here is that materialize is not working for dynamically added elements in the DOM.
E.g In collapsible, it's working for 3 <li>
elements (pre loaded).
For one <li>
element newly added in the dom, i have to run the $('.collapsible').collapsible(); again.
And this solution is really ugly.
Can this be fixed in materialize libary?
from materialize-meteor.
Hi everyone,
I'm facing the exact same issue as described. is there a more elegant workaround (or fix) than just running the $('.collapsible').collapsible(); again ?
from materialize-meteor.
Related Issues (19)
- Materialize has been updated to v0.81 HOT 1
- Can you update source to v0.95? HOT 5
- Some selectors not working on 1.95.0 HOT 2
- Can we have the navbar/sidenav close on every click? HOT 6
- Move to AutoPublish HOT 2
- Toast not working HOT 6
- Remove package from Atmosphere HOT 2
- Clicking on a button keeps making the button whiter until it is completely white
- Clicking on a button keeps making the button whiter until it is completely white!
- Javascript not initializing HOT 12
- Icons don't render HOT 1
- Routing (iron:router) not working on navbar <a> click and navbar not closing properly
- regis
- Update HOT 1
- Adopt version numbers of materializecss releases HOT 1
- version update HOT 1
- Mobile Navbar on 1.94 not closing HOT 4
- Add Atmosphere URL to this GitHub repo page HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialize-meteor.