Skip to content

Commit 6766bb2

Browse files
committed
multi language in select2
1 parent 797c102 commit 6766bb2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: OpenContent/Components/OpenContentAPIController.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,10 @@ public HttpResponseMessage LookupData(LookupDataRequestDTO req)
363363
}
364364
if (json is JArray)
365365
{
366-
AddLookupItems(req.valueField, req.textField, req.childrenField, res, json as JArray);
366+
json = json.DeepClone();
367367
JsonUtils.SimplifyJson(json, DnnLanguageUtils.GetCurrentCultureCode());
368+
AddLookupItems(req.valueField, req.textField, req.childrenField, res, json as JArray);
369+
368370
}
369371
}
370372
return Request.CreateResponse(HttpStatusCode.OK, res);
@@ -403,6 +405,8 @@ public HttpResponseMessage Lookup(LookupRequestDTO req)
403405
{
404406
json = json[req.dataMember];
405407
}
408+
json = json.DeepClone();
409+
JsonUtils.SimplifyJson(json, DnnLanguageUtils.GetCurrentCultureCode());
406410

407411
var array = json as JArray;
408412
if (array != null)
@@ -437,6 +441,9 @@ public HttpResponseMessage Lookup(LookupRequestDTO req)
437441
if (!string.IsNullOrEmpty(req.dataMember))
438442
{
439443
json = json[req.dataMember];
444+
json = json.DeepClone();
445+
JsonUtils.SimplifyJson(json, DnnLanguageUtils.GetCurrentCultureCode());
446+
440447
if (json is JArray)
441448
{
442449
foreach (JToken item in (JArray)json)
@@ -482,6 +489,8 @@ public HttpResponseMessage LookupCollection(LookupCollectionRequestDTO req)
482489
foreach (var item in items)
483490
{
484491
var json = item.Data as JObject;
492+
json = json.DeepClone() as JObject;
493+
JsonUtils.SimplifyJson(json, DnnLanguageUtils.GetCurrentCultureCode());
485494
if (json?[req.textField] != null)
486495
{
487496
res.Add(new LookupResultDTO()

0 commit comments

Comments
 (0)