Author: francois.b
Date: 2010-03-12 18:50:53 +0100 (Fri, 12 Mar 2010)
New Revision: 28514
Modified:
plugins/sfUnobstrusiveWidgetPlugin/trunk/data/assets/js/jquery/uo_widget_form_select_related_choices.jquery.js
Log:
[sfUnobstrusiveWidgetPlugin] fixed related choices (IE & chrome)
Modified:
plugins/sfUnobstrusiveWidgetPlugin/trunk/data/assets/js/jquery/uo_widget_form_select_related_choices.jquery.js
===================================================================
---
plugins/sfUnobstrusiveWidgetPlugin/trunk/data/assets/js/jquery/uo_widget_form_select_related_choices.jquery.js
2010-03-12 17:19:58 UTC (rev 28513)
+++
plugins/sfUnobstrusiveWidgetPlugin/trunk/data/assets/js/jquery/uo_widget_form_select_related_choices.jquery.js
2010-03-12 17:50:53 UTC (rev 28514)
@@ -15,13 +15,13 @@
{
return false;
}
-
this.element.removeClass('uo_widget_form_select_related_choices');
this.element.addClass('uo_widget_form_select_related_choices_ON');
this.id = this.element.attr('id');
this.relatedSelect = $(this.options.related_select);
this.relatedSelectValue = this.relatedSelect.val();
+ this.originalRelatedSelect =
this.relatedSelect.children('option').clone();
// register events
this._registerEvents();
@@ -48,27 +48,11 @@
_updateRelatedChoices: function()
{
var value = this.element.val();
-
- $('option', this.relatedSelect)
- .hide()
- .attr('disabled', 'disabled');
- $('option[value=""]', this.relatedSelect)
- .show()
- .removeAttr('disabled');
- $('option:selected', this.relatedSelect).removeAttr('selected');
-
- if ('' != value)
- {
- if (undefined != this.options.class_prefix)
- {
- value = this.options.class_prefix + value;
- }
-
- $('option.' + value, this.relatedSelect)
- .show()
- .removeAttr('disabled');
- $('option.' + value + '[value="' + this.relatedSelectValue + '"]',
this.relatedSelect).attr('selected', 'selected');
- }
+ this.relatedSelect.children('option').remove();
+ // @TODO check if the first value is empty
+
this.relatedSelect.append(this.originalRelatedSelect.filter('option[value=""]'));
+
this.relatedSelect.append(this.originalRelatedSelect.filter('option.'+value));
+ this.relatedSelect.filter('option[value=""]').attr('selected',
'selected');
},
_registerEvents: function(elements)
@@ -87,4 +71,4 @@
}
});
-})(jQuery);
\ No newline at end of file
+})(jQuery);
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.