我们想知道是否有可能有使用jQuery检查多个元素的功能,并根据通过点击分配给他们的类型,执行其他功能.基本上,一个功能将永远运行,而用户不刷新页面.
这个想法不是依赖事件点击来执行一个函数,而是依赖于分配给特定元素的类.
例如:
$("td.gantt").each(function() {
if($(this).hasClass("oper")) {
//execute a serie of functions
}
if($(this).hasClass("preop")) {
//execute a serie of functions
}
});
Run Code Online (Sandbox Code Playgroud)
以上执行一次,我们需要一直运行.
我正在尝试将Meteor连接到现有的MongoDB.我无法复制数据库或更改其名称,因为其他应用程序使用它.
我知道我必须设置一个MONGO_URL环境var来连接它.但是,在我设置它之后,Meteor没有连接到特定的MongoDB数据库.我尝试过做.find()但不会返回任何文档..insert()Web控制台中的一个显示页面中的信息,但它不会插入数据库中.以下是代码:
$ echo $MONGO_URL
mongodb://localhost:27017/autana_dev
Run Code Online (Sandbox Code Playgroud)
./lib/models.js
Posts = new Meteor.Collection('posts');
Run Code Online (Sandbox Code Playgroud)
./server/app.js
Meteor.publish('posts', function() {
return Posts.find();
});
Run Code Online (Sandbox Code Playgroud)
./client/app.js
Meteor.subscribe('posts');
Template.main.posts = function() {
return Posts.find();
};
Run Code Online (Sandbox Code Playgroud)
任何的想法?任何人?我的Meteor版本是0.6.4.1,MongoDB版本是2.4.1.
更新:7月28日运行meteor后meteor run,我在项目目录中打开了一个新的控制台窗口来运行meteor mongo控制台.但是,跑完后meteor mongo我收到了以下内容:
mongo: Meteor isn't running.
This command only works while Meteor is running your application
locally. Start your application first.
Run Code Online (Sandbox Code Playgroud) 我们有以下XHTML表:
<tr class="encabezado">
<th scope="col" width="2%">1</th>
<th scope="col" width="2%">2</th>
<th scope="col" width="2%">3</th>
<th scope="col" width="2%">4</th>
<th scope="col" width="2%">5</th>
<th scope="col" width="2%">...</th>
<th scope="col" width="2%">31</th>
</tr>
<tr>
<th scope="row">Area 1<input name="line_config" type="hidden" value="0,5,50" /></th>
<td class="gantt"> </td>
<td class="gantt"> </td>
<td class="gantt"> </td>
<td class="gantt"> </td>
<td class="gantt"> </td>
<td class="gantt">...</td>
<td class="gantt"> </td>
</tr>
<tr>
<th scope="row">Area 2 <input name="line_config" type="hidden" value="0,0,10" /></th>
<td class="gantt"> </td>
<td class="gantt"> </td>
<td class="gantt"> </td>
<td class="gantt"> </td>
<td class="gantt"> </td>
<td class="gantt">...</td> …Run Code Online (Sandbox Code Playgroud)