by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 16 23:17
    coveralls commented #3677
  • Jul 16 23:10

    dependabot[bot] on npm_and_yarn

    Bump lodash from 4.17.11 to 4.1… (compare)

  • Jul 16 23:10
    dependabot[bot] labeled #3677
  • Jul 16 23:10
    dependabot[bot] opened #3677
  • May 12 09:22
    paulfalgout commented #3077
  • May 12 09:19
    rvnath commented #3077
  • Apr 08 05:38

    paulfalgout on master

    docs: Fix simple typo, override… (compare)

  • Apr 08 05:38
    paulfalgout closed #3676
  • Apr 06 21:09
    coveralls commented #3676
  • Apr 06 21:08
    timgates42 commented #3676
  • Apr 06 21:08
    timgates42 synchronize #3676
  • Apr 06 19:49
    coveralls commented #3676
  • Apr 06 19:47
    timgates42 opened #3676
  • Mar 11 14:32
    paulfalgout labeled #3675
  • Mar 11 05:20
    danspam opened #3675
  • Feb 05 08:48
    paulfalgout commented #3209
  • Jan 19 01:34
    Purlicue commented #3209
  • Dec 20 2019 15:18

    paulfalgout on master

    Event doc update default value… (compare)

  • Dec 20 2019 15:18
    paulfalgout closed #3674
  • Dec 20 2019 13:03
    coveralls commented #3674
heeplr
@heeplr
is there a difference between using "this.options.foo" and "this.getOption('foo')" ? is one of them considered best practice?
i don't quite get what this means: "If an object's options has an undefined value, it will attempt to read the value from the object directly."
sorry if this is a stupid question :)
gregid
@gregid
@heeplr this.getOption('foo') will first return this.options.foo if it exists; if not it will return this.foo instead. It's up to you to decide if you could encounter such a need in your code.
heeplr
@heeplr
Same for "Note That children represents the views rendered that are or will be attached within the view's el." ... does that mean "That children represents the rendered views, that are or will be ..."?
I wonder, since I get "TypeError: this.children.findByIndex(...) is undefined" in onRenderChildren()
gregid
@gregid
@heeplr if you console.log(this.children) do you get any children print out?
heeplr
@heeplr
no
that would explain it. thanks :)
Paul Falgout
@paulfalgout
that's odd.. what is console.log(this) inside that handler? maybe it's not the collectionview
heeplr
@heeplr
no, it works now. the collectionview hadn't any children so this.children.findByIndex(...) returned undefined (since there was no child with that index)
what I did was this.children.findByIndex(0).$el ... now i'm checking the result before accessing $el and everything works
(and children are rendered but not attached as it seems)
heeplr
@heeplr
what's the purpose of setting View.model? I assumed that it's used to automatically create a model instance in case no model instance is passed when creating a new View, but it seems as this isn't the case.
Paul Falgout
@paulfalgout
well model is an option on the view.. you'd typically pass a model to the view, but I suppose there's potentially a case for a view that always has the same model to store state or something.. a widget of some sort.. but View.model would be identical to new View({ model })
it's a model instance only
heeplr
@heeplr
ohh, it's always a instance
that makes sense. thank you
in my head, I wrongly adapted Backbone.Collection.model to Marionette.View.model :-/
Mark Lester
@mark-lester
I am revisiting my stack, I have a nice open source project so I need to do all the bits nice, so I am going through my glorious shebang and picking out the bits. My key trick is to print a collection of model, or resource definitions at the root of the api, I am using Sequelize and the REST generator is called Finale these days.
Mark Lester
@mark-lester
is there any precedent for this, a data dictionary provided as a collection of resource definitions, supplied at the base of the api. I have seen a list of entity names supplied at /api/ by way of an index, its such an obvious thing to want to do imo.
Luiz Américo
@blikblum

is there any precedent for this, a data dictionary provided as a collection of resource definitions, supplied at the base of the api. I have seen a list of entity names supplied at /api/ by way of an index, its such an obvious thing to want to do imo.

Maybe you are looking at this: https://github.com/blikblum/backbone.state/blob/master/test/unit/resource.spec.js

gregid
@gregid
Not sure if Marionette or Backbone problem but changing view.attributes is not per view instance. Here is minimal example: https://jsfiddle.net/e5nsov4a/1/
Paul Falgout
@paulfalgout

setting attributes in the initialize is after it is used in the life of the view. But in this case you're creating an object on the view protoype and then modifying the object on the view prototype.. so for instance if on the last line of your fiddle you add:

buttonsView.children.each(bView => { console.log(bView.attributes.title); });

it'll log 3 "3 Click this button to take an action"
@gregid

const ButtonView = View.extend({
  tagName: 'button',
  className: 'ui button',
  preinitialize: function (options) {
      this.attributes = { title: this.model.get('title') };
       // or this.attributes = _.extend({}. { title: this.model.get('title') }, this.attributes);
      this.template = _.template(this.model.get('label'))
  },
});
that'd do what you want
on the latest backbone
gregid
@gregid
OK, makes sense now, thanks @paulfalgout !
Mark Lester
@mark-lester
Does anyone have any view for or against dustjs. I am considering using instead of handlebars as I need server and client side evaluation, I have a scheme of {% {@ and {{ for locale specific once only {% and everytime execution {@, and client side evaluation {{. I need synchronous for the server, and also dust had a lighter syntax.
Mark Lester
@mark-lester
well its not been touched for ages, hogan may be better, or maybe i just get the promises to work in handlebars, which is plan A
Andy(Che-An) Wu
@andywu0408
Hi guys, I'm new to marionette and have a question. I have two views, which both use the same one behavior. Inside my behavior class, I have two ui declared (one ui is from View A, one ui is from View B). I want to add an event handler in the behavior class which, when the ui in View A is clicked, I go change the ui in View B. However, I am unable to do this directly by doing things like "this.ui.viewBui.text("change to this"). Is there any way I can do cross view interaction? I can only access this.ui.viewAui and not B's
Paul Falgout
@paulfalgout
adding a behavior to a view adds the same behavior to different views. it's like giving a view a tool that they can use to do something, it does nothing to tell one view about another view. what you probably want is to pass a single model to both views. then one view listens to it's own click and modifes the model, and the other view says, if this model changes, re-render the data
@andywu0408
Andy(Che-An) Wu
@andywu0408
Thanks @paulfalgout
Andy(Che-An) Wu
@andywu0408
Can we trigger a function in a behavior class , from a controller?
Paul Falgout
@paulfalgout
@andywu0408 hmm you can trigger an event on a view that a behavior can listen to..
gregid
@gregid
I need to run some code after a view is already rendered in the dom, I've found references toonDomRefresh in older versions of Marionette - how can I achieve the same with v4.x?
gregid
@gregid
My exact problem is that my view renders gridstack.js dashboard and in order to properly initialize gridstack the elements must be in the dom during GridStack.init()
Paul Falgout
@paulfalgout
onDomRefresh is still available in 4.x and is the event that occurs when the contents of the view's el are added to the DOM
@gregid
gregid
@gregid
@paulfalgout excellent I couldn't find it in docs and was under the impression it was removed - changing from onRender to onDomRefresh automatically fixed my problem
gregid
@gregid
There does seem to be a limitation with onDomRefresh approach - if my DashboardView is a childView of CollectionView and I add a model to Collection the onDomRefresh is not called and the initialization made there is gone
Paul Falgout
@paulfalgout
if onDomRefresh is not called the view does not believe it is in the dom so something up the chain does not understand it is attached for some reason
you can use myView.isAttached() / myCollectionView.isAttached() to determine if the view understands it's el is attached to the DOM
gregid
@gregid
I'll try that
gregid
@gregid
I wonder is there a way to add some divider element in between groups of childViews in CollectionView. At the moment I deal with this like this: https://jsfiddle.net/mthy5k4o/2/ but I was looking for a divider to be a separate element/view added from CollectionView instead?
gregid
@gregid
I've experimented with attachHtml and it seems this will work: https://jsfiddle.net/mthy5k4o/3/ although I wonder if it is safe to use - findByIndex returns correct view so seems fine at first glance.
gregid
@gregid
I see now where it goes awry - adding new buttons to collection makes one big mess: https://jsfiddle.net/mthy5k4o/5/
gregid
@gregid
My current solution to the problem: https://jsfiddle.net/mthy5k4o/7/
dimtabu
@taburetkin

hi guys.
just faced with strange behavior which i never met before.
when compiling with webpack + babel
there is a difference between (i think i have wrong babel options)

View.extend({
   constructor() {
   }
})
new View();

and

View.extend({
   constructor: function() {
   }
})
new View();

in first case there is error: constructor is not a constructor
i think this is because of babel config and maybe someone knows what's exactly i have to specify?