Created
June 19, 2014 17:20
-
-
Save shannah/c86df065a3ef27ab4445 to your computer and use it in GitHub Desktop.
depselect.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d142-58-249-174:depselect shannah$ svn diff -r 5010:5022 . | |
Index: js/xataface/widgets/depselect.js | |
=================================================================== | |
--- js/xataface/widgets/depselect.js (revision 5010) | |
+++ js/xataface/widgets/depselect.js (revision 5022) | |
@@ -24,6 +24,7 @@ | |
//require <jquery-ui.min.js> | |
//require-css <jquery-ui/jquery-ui.css> | |
//require <RecordDialog/RecordDialog.js> | |
+//require <xatajax.form.core.js> | |
//require-css <xataface/widgets/depselect.css> | |
(function(){ | |
var $ = jQuery; | |
@@ -39,13 +40,7 @@ | |
* @return {HTMLElement} The found field or null if it cannot find it. | |
*/ | |
function findField(startNode, fieldName){ | |
- | |
- var parentGroup = $(startNode).parents('.xf-form-group').get(0); | |
- if ( !parentGroup ) parentGroup = $(startNode).parents('form').get(0); | |
- if ( !parentGroup ) return null; | |
- //alert('here'); | |
- var fld = $('[data-xf-field="'+fieldName+'"]', parentGroup).get(0); | |
- return fld; | |
+ return XataJax.form.findField(startNode, fieldName); | |
} | |
@@ -233,7 +228,7 @@ | |
}) | |
.append( | |
$('<option></option>') | |
- .attr('text','Please select...') | |
+ .text('Please select...') | |
.attr('value', '') | |
) | |
.insertAfter(self); | |
@@ -269,7 +264,14 @@ | |
// changes. | |
$(field).change(function(){ | |
//alert('value changed'); | |
+ var oldVal = $(self).val(); | |
+ $(self).val(''); | |
updateValuesFor(self, filters); | |
+ if ( $('option[value="'+oldVal+'"]', self).length > 0 ){ | |
+ $(self).val(oldVal); | |
+ } else { | |
+ $(self).trigger('change'); | |
+ } | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment