(Post by Lloyd Bates)
In this example, the parent Drop list is named "SepTypeCd" and the child is "SepReason".
When an item is selected in the parent the change event looks to see if a child list is required to be available, if a child menu is needed, it populates it, if not it disables the child dropdown control.
With this pattern, we get to use the Ajax Wrapper function to allow getting all the error handling built in as a bonus.
This example has the "if" statement in it, but it doesn’t have to have it.
$(document).ready(function () {
… …
$(
"#SepTypeCd").change(SepTypeCdChange);
… …
});
{
JcdcAjaxDoGetRetrieveJson(actionMethodUrl, GetDDLDataSuccess, {
"Id" : sepTypeCd } );
}
$(
"#SepReasonCd").empty().end();
$(
"#SepReasonCd").attr("disabled", "disabled");
}
}
LoadOptions(jsonDDLDispValueCV,
"SepReasonCd");
}
$.each(jsonDDLDispValueCV,
function(index, option) {
reasons.append($(
'<option/>', { value: option.Value, text: option.Disp } ));
});
reasons.removeAttr(
"disabled").end();
}
No comments:
Post a Comment