Reputation: 926
I am wanting to get into meteor.js to develop an app as its amazing and seems to make web development so much simpler.
The problem is that the app will have 2 connected sortable nested lists that I was going to usemjqueryui sortable for.
I can't find much if any examples or information on using jqueryui with meteor.js, only a few from a long time ago that use old versions of meteor from before spark.
Can anyone show me how this works, what the recommended way to use both together and if possible an example or any references to this.
Also is it recommended to use these together or is there another way / library that I should be using?
Thanks a lot Rick
Upvotes: 4
Views: 1595
Reputation: 723
Rick, I use jquery-ui (as well as other jquery based plugins) with meteor just fine. Generally, I'll give the element its jquery-ui-ness when the relevant template has been rendered, e.g (in coffeescript):
# 'this' references the template
Template.listOne.rendered = ->
$(this.firstNode).find('ul.connectedSortable').sortable
connectWith: '.connectedSortable'
Template.listTwo.rendered = ->
$(this.firstNode).find('ul.connectedSortable').sortable
connectWith: '.connectedSortable'
or, you can make an element sortable after some event, e.g.:
# 'this' now equals Window, so we must find the list from the event target
Template.listOne.events
'click button': (e) ->
$(e.target).parent().find('ul.connectedSortable').sortable
connectWith: '.connectedSortable'
Upvotes: 3