appendTo不按预期工作(appendTo not working as expected)
我有一个简单的UL,所有LI都有class =“event”。
以下jQuery未按预期工作。
$('#calendar-feed li.event').each(function() { $(this).find('h3').appendTo('h4'); });
我想把每个LI中唯一的h3加到那个LI中唯一的h4。
目前它正在接收所有H3并将它们克隆到每个H4中。
我的语法是错误的还是我错误地思考了这个问题?
I have a simple UL with all LI's having class="event".
The following jQuery is not working as expected.
$('#calendar-feed li.event').each(function() { $(this).find('h3').appendTo('h4'); });
I'd like to take the only h3 in every LI and append it to the only h4 in that LI.
Currently it is taking all the H3s and cloning them into each H4.
Is my syntax just wrong or am I thinking about this the wrong way?
原文:https://stackoverflow.com/questions/16240941
最满意答案
该框架完全按照预期工作。 您需要熟悉它如何决定创建新记录或通过阅读以下页面更新现有记录: http : //javalite.io/surrogate_primary_keys
基本上,你正在删除一条记录:
rs.delete();
所以,下次你做:
rs.saveIt();
它创造了一个新纪录。 只需删除
rs.delete();
你会没事的。The framework is working exactly as expected. You need to familiarize yourself with how it decides to create a new record or update an existing one by reading this page: http://javalite.io/surrogate_primary_keys
Basically, you are deleting a record by:
rs.delete();
so, next time you do:
rs.saveIt();
it creates a new record. Simply remove the
rs.delete();
and you will be fine.
相关问答
更多-
我通过实现StringBridge得到了解决方案,如下所示: @Override public String objectToString(Object value) { if(value != null) { String templateType = null; if(value instanceof Set) { StringBuilder strBuild = new StringBu ...
-
你无法与这张桌子互动。 Doctrine将处理它,就像Roger Guasch在评论中所说的那样,你必须创建对应实体的访问器。 如果需要直接与此实体进行交互,则必须自己定义它,将mn表作为实体进行威胁。 然后你可以参考它。 希望能帮助到你! You cant interact with this table. Doctrine will handle it, and like Roger Guasch said on the comments, you have to create accessors to ...
-
您的查询有一些语法错误,但您的问题的答案基本上是CASE表达式: SELECT c.client_id, c.client_name, SUM(t.Amount) AS Balance, (CASE WHEN SUM(t.Amount) < 0 THEN 'OFF' ELSE 'ON' END) as status FROM client c JOIN transactions t ON t.client_id = c.client_id GROUP BY c.clien ...
-
该框架完全按照预期工作。 您需要熟悉它如何决定创建新记录或通过阅读以下页面更新现有记录: http : //javalite.io/surrogate_primary_keys 基本上,你正在删除一条记录: rs.delete(); 所以,下次你做: rs.saveIt(); 它创造了一个新纪录。 只需删除rs.delete(); 你会没事的。 The framework is working exactly as expected. You need to familiarize yourse ...
-
请记录此问题: https : //github.com/javalite/activejdbc/issues并提供完整说明以复制此情况。 最好的,如果你可以提供一个小项目。 Please, log this as an issue: https://github.com/javalite/activejdbc/issues and provide full instructions to replicate this condition. Best if you can provide a small p ...
-
你做了一个has_many :though 。 在这种情况下,连接表需要有一个主键(通常为:id)。 否则,您无法像此处一样直接访问连接表。 另一方面,如果您不需要直接访问连接表(例如,那里没有额外的列),那么您可以设置has_and_belongs_to_many,连接表没有id列。 You're doing a has_many :though. In this case, the join table needs to have a primary key (usually :id). Otherwi ...
-
从连接表过滤(Filtering from join-table)[2023-04-13]
JOIN解决方案: SELECT t.* FROM topics t JOIN tags_topics t1 ON (t.id = t1.topicId AND t1.tagId = 1) JOIN tags_topics t2 ON (t.id = t2.topicId AND t2.tagId = 2) JOIN tags_topics t3 ON (t.id = t3.topicId AND t3.tagId = 3) GROUP BY解决方案: 请注意,除非使用MySQL或SQLite,否则 ... -
如果用户属于许多项目,并且项目具有已注册的列,则可以执行此操作 project.addUser(user, { enrolled: new Date() }); 如果已经设置了用户和项目之间的关系,这也应该有效,在这种情况下,连接表将被更新。 文档在本节末尾。 If user belongs to many projects, and the project has an enrolled column you can do project.addUser(user, { enrolled: new Da ...
-
好吧,正如@Jason指出的那样,我尝试了两种方式,事实证明它的工作原理相同:) create_join_table :products, :suppliers do |t| # either directly here t.index [:product_id, :supplier_id], :unique => true end # or afterwards, both work add_index(:products_suppliers, [:product_id, :suppli ...
-
如果我理解正确,您想要在第二个表中胜过CustomerNumber的现有值? 要做到这一点,光标不是最好的主意,因为它们按顺序工作。 也许尝试这样的事情: ; WITH CTE1 AS ( SELECT CustomerNumber, ROW_NUMBER() OVER (ORDER BY (SELECT 100)) AS SNO FROM customerInfo ), CTE2 AS ( SELECT Id, CustomerNumber, ROW_NUMBER() OVER ( ...