jqTransform Select - Ajax更新? [英] jqTransform Select - Ajax Update?

查看:96
本文介绍了jqTransform Select - Ajax更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jqTransform插件来设置表单元素的样式,这导致我的选择框出现轻微问题。看起来隐藏的选择框被替换为包含列表等的自定义DIV。

I'm using the jqTransform plugin to style my form elements, which has led to a slight problem with my select boxes. It appears the select box is hidden and replaced by a custom DIV containing a list, etc.

我设法让插件触发选择的点击事件从列表中选择,但我在更新可视列表时遇到一些麻烦 - 看起来该插件不支持开箱即用的ajax更新。

I've managed to get the plugin firing the select's click event when something is selected from the list, but I'm having a little trouble updating the visual list - it appears the plugin doesn't support ajax update out of the box.

有没有人有对jqTransform转换的选择执行ajax更新的经验吗?

Does anyone have experience of performing ajax updates on selects transformed by jqTransform?

转换后的选择类似于:

<div class="jqTransformSelectWrapper" style="z-index: 8; width: 63px; ">
<div>
<span style="width: 62px; ">Petrol</span><a href="#" class="jqTransformSelectOpen"></a>         </div>
<ul style="width: 63px; height: 24px; overflow-x: hidden; overflow-y: hidden; display: none; visibility: visible; ">
<li><a href="#" index="0" class="selected">Petrol</a></li></ul>
<select id="fuel_type_id" name="fuel_type[id]" class="jqTransformHidden" style=""><option value="1">Petrol</option></select>
</div>

该插件不会转换已经转换的选择(您可以通过删除jqTransformHidden类来强制它,但这只是重复可见的选择)。

The plugin won't transform an already transformed select (you can force it to by removing the jqTransformHidden class, but that just duplicates the visible select).

我想知道是否有一些聪明的jquery可以用来将select返回到它的前状态然后再次执行转换?

I wonder if there's some clever jquery I could use to return the select to it's former state and then perform the transform again?

谢谢,

保罗

推荐答案

以下是对我来说:

function fix_select(selector) {
    var i=$(selector).parent().find('div,ul').remove().css('zIndex');
    $(selector).unwrap().removeClass('jqTransformHidden').jqTransSelect();
    $(selector).parent().css('zIndex', i);
}
fix_select('select#my_updated_select_box');

这篇关于jqTransform Select - Ajax更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆