by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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
  • Dec 20 2019 13:02
    mochja edited #3674
  • Dec 20 2019 13:01
    mochja opened #3674
  • Oct 21 2019 06:40

    paulfalgout on master

    docs: Fix typos in Class Events… (compare)

  • Oct 21 2019 06:40
    paulfalgout closed #3673
Paul Falgout
@paulfalgout
there might be some way to deal with this, but it's a design issue in backbone for how events are delegated
heeplr
@heeplr
i see, it looked like it's not avoidable but wanted to be sure
paulfalgout: thanks
gregid
@gregid
When I add model to collection in my CollectionView it doesn't render the view, and when I add onCollectionChange event calling this.render() I end up with duplicated view for newly added model. Looking for ideas what is going on.
gregid
@gregid
I should add the collection is actually a https://github.com/p3drosola/Backbone.VirtualCollection and the problem is only when changing the model's attribute of the underlying collection. If completely new model is added it works as expected.
Paul Falgout
@paulfalgout
ah hmm.. might be related to p3drosola/Backbone.VirtualCollection#99
gregid
@gregid
thanks - that might be it let me check
that particular fix didn't help but it gives me some ideas to explore - before I wrote the question I assumed it must have been marionette issue
gregid
@gregid
what events does marionette respond to for rendering collection view?
Paul Falgout
@paulfalgout
I'd bet there's some sort of listener that could be added to fix the issue.. but I'm not very familiar with the virtualcollection.
reset and update
well and sort.. which could possibly produce some of the odd things if update isn't in the mix.. maybe?
FWIW, I'm sure there's use cases where virtual collection make some sense, but I'd also bet for the generic filtering marionette.collectionview in v4 does the same job.. and sometimes faster...
gregid
@gregid
VC reduced a lot of complexities I had in my code but if I won't be able to make it work I will probably have to revert back. Thanks again - I'll experiment a bit more.
gregid
@gregid
I got it to work with a slight change to the above PR: this.trigger('update', this, { changes: { removed: [model], added: [] }, }); although it seems there will be further issues with the VC
heeplr
@heeplr
what would be a clean way to assign a class to only the first child view element of a CollectionView?
i'm trying to implement a bootstrap carousel using a CollectionView and it seems to be a problem when no child has the "active" class.
heeplr
@heeplr
...currently im doing "$(this.$el[0].firstElementChild).addClass(...)" in onRenderChildren(), but it doesn't look ... well, right. :)
gregid
@gregid
gregid
@gregid
pass className in childViewOptions and in your ChildView set class dynamically from options
heeplr
@heeplr
@gregid: ah, of course! thank you
heeplr
@heeplr
hm, despite the returned child view has the correct view.className string, the attached DOM element has not.
i certainly am doing it wrong
gregid
@gregid
@heeplr try setting className in preinitialize in your ChildView
heeplr
@heeplr
@gregid: how? "this.className = attributes.className;" doesn't seem to have any effect
hm, i guess this is the way and there's something else that's going wrong
heeplr
@heeplr
nvm, found the problem
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