Hey guys,
It seems the jsonCase argument in the RequestContext.renderData has been removed in CB3.5.
I kind of miss it because some of the JQuery UI widgets use JSON with lower case labels and CB3.5’s renderData(type=“JSON”) returns JSON with upper case labels.
So where JQuery normally would do stuff natively like for instance the autocomplete widget, I now have to do extra mapping…
Example:
autocomplete expects JSON format = [{“id”:“someID”,“label”:“someLabel”,“value”:“someValue”},{“id”:“someOtherID”,“label”:“someOtherLabel”,“value”:“someOtherValue”},…]
but ColdBox 3.5 returns = [{“ID”:“someID”,“LABEL”:“someLabel”,“VALUE”:“someValue”},{“ID”:“someOtherID”,“LABEL”:“someOtherLabel”,“VALUE”:“someOtherValue”},…]
So where normally following would do:
$( “#branchCity” ).autocomplete({
source: ‘#event.buildLink(“ajax/autoCompleteCities”)#’,
minLength: 2
});
I now have to map my upper case variables to lower case:
$( “#branchCity” ).autocomplete({
source: function(request, response){
$.getJSON(
‘#event.buildLink(“ajax/autoCompleteCities”)#’,
{term: request.term},
function(data){
response( $.map( data, function( item ) {
return {
id: item.ID ,label: item.LABEL, value: item.VALUE
}
}));
}
);
},
minLength: 2
});
As you can see, a pretty huge difference… Any reason for this change?