I am creating a tree grid and I perform server-side validation that I set the errors in the database so that when the users fetches the data again the errors will show on the field again. I do this on fetch by on the server returning an error array of fieldname:{errormessages} per JSON row object. The fetch code handles these as such:
This seems to work in that the fields are marked with the exclamation point icon. However on mouse over only the first field with an error in a row popups the message the others in the same row don't show the error.
Code:
fetchData(null, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { for(Record r:response.getData()) { JSONArray errors = XMLTools.selectObjects(r.getJsObj(), "errors"); HashMap<String, String[]> es = new HashMap<String, String[]>(); for(int e=0;e<errors.size();e++){ JSONObject error = errors.get(e).isObject(); for(String key:error.keySet()) { JSONArray ers = error.get(key).isArray(); String msgs[] = new String[1]; if(ers != null) { msgs = new String[ers.size()]; for(int m=0;m<ers.size();m++) { msgs[m] = ers.get(m).isString().stringValue(); } } else msgs[0] = error.get(key).toString(); es.put(key, msgs); } } setRowErrors(getRecordIndex(r), es); } } });
Comment