Skip to content

Commit a636d6f

Browse files
dmendezSFernandez1994
authored andcommitted
Cherry pick branch 'genexuslabs:Issue95191' into beta
1 parent 178512a commit a636d6f

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

java/src/main/java/com/genexus/internet/HttpAjaxContext.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import java.util.Enumeration;
77
import java.util.Hashtable;
88
import java.util.Stack;
9+
import java.util.Collections;
10+
import java.util.Arrays;
911

1012
import com.genexus.diagnostics.core.ILogger;
1113
import com.genexus.diagnostics.core.LogManager;
@@ -25,7 +27,8 @@ public abstract class HttpAjaxContext
2527
protected JSONObject Messages = new JSONObject();
2628
private JSONObject WebComponents = new JSONObject();
2729
private Hashtable<Integer, JSONObject> LoadCommands = new Hashtable<>();
28-
private JSONArray Grids = new JSONArray();
30+
private ArrayList Grids = new ArrayList();
31+
private Hashtable<String, Integer> DicGrids = new Hashtable<String, Integer>();
2932
private JSONObject ComponentObjects = new JSONObject();
3033
protected GXAjaxCommandCollection commands = new GXAjaxCommandCollection();
3134
protected GXWebRow _currentGridRow = null;
@@ -465,13 +468,17 @@ public void ajax_rsp_assign_hidden_sdt( String SdtName, Object SdtObj)
465468
}
466469
}
467470

468-
public void ajax_rsp_assign_grid(String gridName, com.genexus.webpanels.GXWebGrid gridObj)
471+
public void ajax_rsp_assign_grid(String gridName, com.genexus.webpanels.GXWebGrid gridObj, String Control)
469472
{
470-
try {
471-
Grids.putIndex(0, gridObj.GetJSONObject());
472-
}
473-
catch (JSONException e) {
474-
}
473+
Object jsonObj = ((IGxJSONAble) gridObj).GetJSONObject();
474+
if (DicGrids.containsKey(Control)) {
475+
Grids.set(DicGrids.get(Control), jsonObj);
476+
}
477+
else
478+
{
479+
Grids.add(jsonObj);
480+
DicGrids.put(Control, Grids.size() - 1);
481+
}
475482
}
476483

477484
public void ajax_rsp_clear(){
@@ -566,6 +573,8 @@ protected String getJSONResponsePrivate(String cmpContext)
566573
GXJSONObject jsonCmdWrapper = new GXJSONObject(isMultipartContent());
567574
try
568575
{
576+
Collections.reverse(Arrays.asList(Grids));
577+
JSONArray JSONGrids = new JSONArray(Grids);
569578
if (commands.AllowUIRefresh())
570579
{
571580
if (cmpContext == null || cmpContext.equals(""))
@@ -578,7 +587,7 @@ protected String getJSONResponsePrivate(String cmpContext)
578587
jsonCmdWrapper.put("gxValues", AttValues);
579588
jsonCmdWrapper.put("gxMessages", Messages);
580589
jsonCmdWrapper.put("gxComponents", WebComponents);
581-
jsonCmdWrapper.put("gxGrids", Grids);
590+
jsonCmdWrapper.put("gxGrids", JSONGrids);
582591
}
583592
for(Enumeration loadCmds = LoadCommands.keys(); loadCmds.hasMoreElements();)
584593
{

0 commit comments

Comments
 (0)