0
데이터가 데이터베이스에서 오는 ComboBoxItem
의 드롭 다운 메뉴에 새 행을 추가하려고합니다. 값이 "-1"인 빈 행 또는 의 응답에 null
DSResponse 데이터를 편집하는 방법
Criteria c2 = new Criteria();
OptionListDataSource attrTypeds = OptionListDataSource
.getInstance(FieldNames.ATTRIBUTE_TYPE_FIELD);
attrTypeds.fetchData (c2, new DSCallback() {
@Override
public void execute(final DSResponse response,
final Object rawData, final DSRequest request) {
Record[] recList = response.getData();
if (recList != null) {
StringBuilder builder= new StringBuilder();
int recListLength = recList.length;
Window.alert("Lenght of Response is : "+recListLength);
for(int i=0;i<recListLength;i++){
Window.alert("Data at "+i+" : "+recList[i].getAttribute(FieldNames.ID_FIELD));
Record record = recList[i];
JavaScriptObject js = record.getJsObj();
JSONObject jsonn = new JSONObject(js);
builder.append(jsonn.toString());
}
Window.alert("JSON Response : "+builder);
recList[recListLength+1].setAttribute(FieldNames.ID_FIELD, "-1");
Window.alert("Updated lenght of Response is : "+recList.length);
Window.alert("Updated Value at last position : "+recList[recList.length].getAttribute(FieldNames.ID_FIELD));
initialValuesMap.put(FieldNames.ATTRIBUTE_TYPE_ID_FIELD,recList[recList.length].getAttribute(FieldNames.ID_FIELD));
}
form.editNewRecord(initialValuesMap);
}
});
Window.alert("JSON Response : "+builder);
다음 경고문이 표시되지 않습니다. 내가 뭘 잘못하고있어? 빈칸/null
데이터를 Record[] recList
에 추가하고 싶습니다. 또한 이것에 대해 Criteria
이 있습니까? 당신이 빈 옵션은 기본적으로 올 것이다 SelectItem 대신 ComboBoxItem를 사용하고 아무것도 할 필요가없는 경우에 나는 smartgwt 버전 3
이 모든 구현을 변경해야합니다. recList [] = response.getRecord();를 기록하십시오. 레코드 blankRecord = 새 레코드(); 레코드 recTemp [] = 새 레코드 [recList.length]; (레코드 rec : recList) { \t recTemp.getAttribute (rec.getAttribute ("OLDKEY"))); \t} recTemp [recList.length-1] = blankRecord; recTemp [recList.length-1] .setAttribute ("KEY1", "Value1"); recTemp [recList.length-1] .setAttribute ("KEY2", "Value2"); '이 방법을 시도했지만 값을 추가했지만 UI에는 반영되지 않습니다. – Amolb