asp.net - Javascript store not removing all elements before re-adding -
so have dropdown setup on page called ddlvehicletype populated store. method gets called when dropdown changed, , it's supposed remove items aforementioned store, re-add them needed, , populate dropdown new values.
it's doing it's supposed except clearing store before re-adds values, result is, when switch, i'm getting used plus new values should in there themselves.
here weird thing though, when switch back, values removed without re-adding anything. can tell me i'm doing wrong? method below:
function filtervehicletypes() { var masterstore = global.getcomponent("vehicletypestore").getstore(); var source = global.getcomponent("ddlvaluationsource").getrawvalue(); var isincuded = ''; var includeflags = ''; if (source == undefined || source == null) source = ''; global.getcomponent("ddlvehicletype").getstore().removeall(false); masterstore.each(function(rec) { switch (source.touppercase()) { case 'kbb': if (rec.get('code') == 'kbb') { global.getcomponent("ddlvehicletype").store.add(rec); } case 'nada': includeflags = rec.get('misccode1'); if (includeflags != null) { isincuded = includeflags.substr(1, 1); if (isincuded == 'y' && rec.get('code') == 'nada') { global.getcomponent("ddlvehicletype").store.add(rec); } } break; default: includeflags = rec.get('misccode1'); if (includeflags != null) { isincuded = includeflags.substr(0, 1); if (isincuded == 'y') { global.getcomponent("ddlvehicletype").store.add(rec); } } break; } }); }
no
break;
in first case. doh!
Comments
Post a Comment