如何在调用css之前调用钩子,在JQUERY中使用html函数?(how to invoke hook before calling css , html functions using in JQUERY?)
我满足了从用户那里获取js语句并应用于页面的要求
由于某种原因,我必须保持元素的跟踪状态
当用户给出类似的陈述时,我面临问题
$("someselector").css("color":"red");
要么
$("someselector").html("new text");
我将获得声明并在页面中应用,在这里我无法采取原始元素的备份
在jquery中有什么方法我可以在调用css,html函数之前调用一个钩子函数并进行元素备份
I meet the requirement where i get the js statements from the user and apply to the page
for some reason i have to keep track state of the element
i am facing problem when user gives the statments like
$("someselector").css("color":"red");
or
$("someselector").html("new text");
i will get the statements and apply in page, here i am not able to take the backup of original element
is there any way in jquery where i can call a hook function before calling css , html function and take the element backup
原文:https://stackoverflow.com/questions/42927802
最满意答案
在你的双向关系中,
Tenant
是关系的所有者。 由于您坚持Apartment
您必须手动设置租户的公寓 。 如果您想摆脱手动设置,请按照以下步骤更改@OneToMany
:@OneToMany(cascade = CascadeType.ALL) @JoinColumn(name="ApartmentID",referencedColumnName="ApartmentID") private List<Tenant> tenants;
顺便说一下,如果你是租客和公寓 ,你现在的样本; 公寓将自动持续。
In your bi-directional relationship
Tenant
is the owner of the relationship. Since you are persistingApartment
you have to manually set the apartment of tenant. If you want to get rid of manual setting change your@OneToMany
as follows:@OneToMany(cascade = CascadeType.ALL) @JoinColumn(name="ApartmentID",referencedColumnName="ApartmentID") private List<Tenant> tenants;
By the way, with your current sample if you are persisting tenant with apartment; apartment will be automatically persisted.
相关问答
更多-
你必须映射你的类。 public class User { ... @OneToOne (mappedBy="user") private UserPicture userPicture; ... } public class UserPicture { ... @OneToOne @JoinColumn (name="user") private User user; ... } You have to map your clas ...
-
流畅的NHibernate:如何创建一对多的双向映射?(Fluent NHibernate: How to create one-to-many bidirectional mapping?)[2021-07-22]
要在“详细信息”表中获取与非空外键列的双向关联,您可以在DetailsMap类中添加建议的Owner属性,参考(...)CanNotBeNull()映射,并将Summary结束反向。 为避免两个关联方向有两个不同的外键列,您可以手动指定列名称,也可以以两个方向给出相同列名称的方式命名属性。 在这种情况下,我建议将Details.Owner属性重命名为Details.Summary。 我通过增量生成了Summary id,以避免在插入表时出现问题,因为Summary currenty除了id之外没有列。 域: ... -
甚至可以在JSON中表示双向关系吗? 一些数据格式不适合某些类型的数据建模。 在处理遍历对象图时处理循环的一种方法是跟踪您到目前为止看到的对象(使用身份比较),以防止自己进入无限循环。 Can a bi-directional relationship even be represented in JSON? Some data formats are not good fits for some types of data modelling. One method for dealing with cy ...
-
暂时我正在做一个session.update(父)。 这使CHILD表中存在的外键和孤立记录无效。 在我手动完成了孤儿的session.delete(...)之后。 这更像是一种解决方法,而不是解决方案。 For the time being I am doing an session.update(parent). Which nullify the foreign keys and orphan records exist in the CHILD table. And there after I do ...
-
我正在使用JPA 2.1和Hibernate 5.0.1。 以下为我工作: 两个映射对象成员都使用以下注释: @OneToOne(optional = true) @JoinColumn(name = "common_identifier", referencedColumnName = "common_identifier", insertable = false, updatable = false) 让两个实体都实现Serializable。 我不确定为什么这部分是必要的,但它似乎是。 I am u ...
-
我有一个类似的问题,我通过使用自定义序列化器/解串器来解决它 这是我如何进行的(请适应您自己的代码): ChildSerializer public class ChildSerializer extends StdSerializer
{ private static final long serialVersionUID = -265706839304575646L; public ChildSerializer(Class t) { sup ... -
尝试修改集而不是替换它。 即: quotation.getQuotationItem().clear(); quotation.getQuotationItem().addAll(newSet); 这是由于一些冬眠的怪异。 除此之外,还有一点关于命名。 您的Quotation.quotationItem应该命名为quotationItems因为它包含多个QuotationItem 。 Try to modify the set rather than replace it. i.e.: ...
-
你没有使用正确的映射。 虽然每个员工可能只有1个部门,但每个部门可能有1个以上的员工。 因此,您在查询中看到的错误。 它只期望1名员工,但却获得了多名员工。 You're not using the right mapping. While it may be true that each employee has just 1 department, each department presumably has more than 1 employee. Thus the error you see on ...
-
双向一对多(Bidirectional One-To-Many)[2023-05-14]
好吧,我自己想通了。 诀窍是显示错误消息: error_reporting(E_ALL); ini_set('display_errors', '1'); 我需要用值填充一些字段。 不允许为空。 DOH! Ok, I figured it out myself. The trick was to show error messages: error_reporting(E_ALL); ini_set('display_errors', '1'); I needed to fill some fields ... -
在你的双向关系中, Tenant是关系的所有者。 由于您坚持Apartment您必须手动设置租户的公寓 。 如果您想摆脱手动设置,请按照以下步骤更改@OneToMany : @OneToMany(cascade = CascadeType.ALL) @JoinColumn(name="ApartmentID",referencedColumnName="ApartmentID") private List
tenants; 顺便说一下,如果你是租客和公寓 ,你现在的样本; 公寓将自动持续。 ...