CC-4298: Smart Block: Sometimes criteria value text box doesn't resize properly

-fixed
This commit is contained in:
denise 2012-08-27 16:46:05 -04:00
parent 0edfb10f19
commit 7c5765ccb9
1 changed files with 6 additions and 8 deletions

View File

@ -102,24 +102,24 @@ function setSmartBlockEvents() {
* next row * next row
*/ */
if (curr.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled" if (curr.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled"
&& next.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled") { && next.find('#extra_criteria').is(':visible')) {
var criteria_extra = next.find('[name^="sp_criteria_extra"]').val(); var criteria_extra = next.find('[name^="sp_criteria_extra"]').val();
curr.find('[name^="sp_criteria_extra"]').val(criteria_extra); curr.find('[name^="sp_criteria_extra"]').val(criteria_extra);
disableAndHideExtraField(next.find(':first-child'), index+1); disableAndHideExtraField(next.find(':first-child'), getRowIndex(next));
/* if only the current row has the extra criteria value, /* if only the current row has the extra criteria value,
* then just remove the current row's extra criteria element * then just remove the current row's extra criteria element
*/ */
} else if (curr.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled" } else if (curr.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled"
&& next.find('[name^="sp_criteria_extra"]').attr("disabled") == "disabled") { && next.find('#extra_criteria').not(':visible')) {
disableAndHideExtraField(curr.find(':first-child'), index); disableAndHideExtraField(curr.find(':first-child'), index);
/* if only the next row has the extra criteria value, /* if only the next row has the extra criteria value,
* then add the extra criteria element to current row * then add the extra criteria element to current row
* and assign next row's value to it * and assign next row's value to it
*/ */
} else if (next.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled") { } else if (next.find('#extra_criteria').is(':visible')) {
criteria_extra = next.find('[name^="sp_criteria_extra"]').val(); criteria_extra = next.find('[name^="sp_criteria_extra"]').val();
enableAndShowExtraField(curr.find(':first-child'), index); enableAndShowExtraField(curr.find(':first-child'), index);
curr.find('[name^="sp_criteria_extra"]').val(criteria_extra); curr.find('[name^="sp_criteria_extra"]').val(criteria_extra);
@ -203,11 +203,10 @@ function setSmartBlockEvents() {
/********** CRITERIA CHANGE **********/ /********** CRITERIA CHANGE **********/
form.find('select[id^="sp_criteria"]:not([id^="sp_criteria_modifier"])').live("change", function(){ form.find('select[id^="sp_criteria"]:not([id^="sp_criteria_modifier"])').live("change", function(){
var index_name = $(this).attr('id'), var index = getRowIndex($(this).parent());
index_num = index_name.charAt(index_name.length-1);
// disable extra field and hide the span // disable extra field and hide the span
disableAndHideExtraField($(this), index_num); disableAndHideExtraField($(this), index);
populateModifierSelect(this, true); populateModifierSelect(this, true);
}); });
@ -394,7 +393,6 @@ function disableAndHideExtraField(valEle, index) {
} }
function sizeTextBoxes(ele, classToRemove, classToAdd) { function sizeTextBoxes(ele, classToRemove, classToAdd) {
var form = $('#smart-block-form');
if (ele.hasClass(classToRemove)) { if (ele.hasClass(classToRemove)) {
ele.removeClass(classToRemove).addClass(classToAdd); ele.removeClass(classToRemove).addClass(classToAdd);
} }