jQuery jPicker完全重置 [英] jQuery jPicker reset completely
问题描述
如果有任何使用jPicker的经验的人,我真的希望对此有所帮助.我在表单中有一个jPicker输入框,当我使用Ajax发布表单时,我尝试将表单重置为原始值.除了我不知道如何将jPicker框重置为其原始状态外,有人知道如何执行此操作吗?
If anyone experienced with jPicker, I would really like some help on this. I have a jPicker input box in a form, and when I post the form with Ajax, I try to reset the form back to it's original values. Except that I have no idea how to reset the jPicker box to it's original state, does anyone know how to do this?
推荐答案
jPicker 在$.jPicker.List[]
数组中维护其控制信息.要删除与控件的jPicker关联,您将需要销毁其在$.jPicker.List[]
数组中的相应条目.
jPicker maintains the information for its control in the $.jPicker.List[]
array. To remove the jPicker association with the control you will need to destroy its corresponding entry in the $.jPicker.List[]
array.
遍历数组中的项目列表,找到使用
Loop through the list of items in the array to find the one that references the control with
$.jPicker.List[index].id
当您在数组中找到控件时,用
When you find your control in the array, destroy it with
$.jPicker.List[index].destroy()
销毁数组元素后,您将需要删除与控件关联的SPAN jPicker html对象.如果只有一个,您可以
After destroying the array element, you will need to remove the SPAN jPicker html object associated with the control. If there is only one you can
$('span.jPicker').remove()
否则,您将需要发现特定的html元素
otherwise you will need to discover the specific html element
$(rowParent).find('span.jPicker').remove();
可选:如果您使用的是类引用与ID引用,请使用.data()函数标记控件,并使用以下语句检索唯一值
Optionally: if you are using class reference vs. id reference, use the .data() function to tag your control and use the following statement to retrieve the unique value
$( $.jPicker.List[index] ).data()
这篇关于jQuery jPicker完全重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!