Jqueryui与meteor.js

时间:2012-10-19 18:54:47

标签: javascript jquery jquery-ui meteor

我想进入meteor.js来开发一个应用程序,因为它的惊人,似乎使Web开发变得更加简单。

问题是应用程序将有2个连接的可排序嵌套列表,我将使用mjqueryui进行排序。

关于在meteor.js中使用jqueryui的任何示例或信息,我找不到太多,只是很久以前使用旧版本的meteor而不是spark。

任何人都可以告诉我这是如何工作的,建议的方法是两者一起使用,如果可能的话,还是一个例子或任何引用。

还建议一起使用这些,还是我应该使用另一种方式/库?

非常感谢 瑞克

1 个答案:

答案 0 :(得分:3)

瑞克,     我使用jquery-ui(以及其他基于jquery的插件)和meteor一样好。通常,我会在渲染相关模板时给元素赋予jquery-ui-ness,例如(在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'

或者,您可以在某个事件之后使元素可排序,例如:

# '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'