Code Monkey home page Code Monkey logo

Comments (11)

Sivli-Embir avatar Sivli-Embir commented on July 30, 2024

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.

ctaloi avatar ctaloi commented on July 30, 2024

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();
};
<template name="downNodes">
    <h6 class="flow-text center right-align blue-grey-text">Solarwinds Events ({{getPublishedCount 'outageCount'}})</h6>
    <ul class="collapsible" data-collapsible="accordion">

    {{#each nodes}}
        {{> nodeList}}
    {{/each}}

    </ul>
</template>

<template name="nodeList">
        <li>
            <div class="waves-effect waves-yellow flow-text collapsible-header white-text red accent-2">{{node_name}}
                <i class="mdi-social-whatshot"></i>
                <span class="secondary-content white-text em">{{livestamp date}}</span>
            </div>

            <div class="collapsible-body">
                <p>
                    <h5>{{node_name}}</h5>
                    <h5>{{node_ipaddress}}</h5>
                    <a class="waves-effect btn waves-light blue" href="http://solarwinds.wcs.com/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:{{_id}}" target="_blank">
                        <i class="mdi-action-exit-to-app">Solarwinds</i>
                    </a>
                </p>
            </div>
        </li>
</template>

I've been digging for a solution - but haven't had much luck.

from materialize-meteor.

Sivli-Embir avatar Sivli-Embir commented on July 30, 2024

@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.

ctaloi avatar ctaloi commented on July 30, 2024

@Kestanous wish I could - but sorry, I can't.. I can probably put something together.... let me know, thank you !

from materialize-meteor.

Sivli-Embir avatar Sivli-Embir commented on July 30, 2024

@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.

ctaloi avatar ctaloi commented on July 30, 2024

@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.

Dogfalo avatar Dogfalo commented on July 30, 2024

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.

Sivli-Embir avatar Sivli-Embir commented on July 30, 2024

@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.

Sivli-Embir avatar Sivli-Embir commented on July 30, 2024

@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.

stantoncharlton avatar stantoncharlton commented on July 30, 2024

@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.

delachurch avatar delachurch commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.