Hi , I'm trying to populate value map of SelectItem with an rpc call , I do need the some values from the database.
My current code is:
I have this error which does not appear when the values are hardcoded:
My current code is:
private static SelectItem getProfessorSelection() {
final SelectItem profSelection = new SelectItem();
profSelection.setName("description");
profSelection.setTitle("Professor");
profSelection.setColSpan(4);
profSelection.setDefaultToFirstOption(true);
profSelection.setVisible(user.isAdmin());
professorService.readProfessors(new AsyncCallback<FetchResult<ProfessorDto>>() {
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
public void onSuccess(FetchResult<ProfessorDto> result) {
// TODO Auto-generated method stub
List<String> valueMap = new ArrayList<String>();
for(ProfessorDto professorDto:result.getFetchedList()){
valueMap.add(professorDto.getFirstNameField());
}
String[] array = new String[]{};
profSelection.setValueMap(valueMap.toArray(array));
}
});
return profSelection;
}
final SelectItem profSelection = new SelectItem();
profSelection.setName("description");
profSelection.setTitle("Professor");
profSelection.setColSpan(4);
profSelection.setDefaultToFirstOption(true);
profSelection.setVisible(user.isAdmin());
professorService.readProfessors(new AsyncCallback<FetchResult<ProfessorDto>>() {
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
public void onSuccess(FetchResult<ProfessorDto> result) {
// TODO Auto-generated method stub
List<String> valueMap = new ArrayList<String>();
for(ProfessorDto professorDto:result.getFetchedList()){
valueMap.add(professorDto.getFirstNameField());
}
String[] array = new String[]{};
profSelection.setValueMap(valueMap.toArray(array));
}
});
return profSelection;
}
0:01:13,232 [ERROR] 19:55:02.803:MUP1:ERROR:ResultSet:isc_ResultSet_2 (created by: isc_PickListMenu_0):Invalid dataSource: null, a ResultSet must be created with a valid DataSource
Stack trace:
ResultSet.init(Obj, Obj, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) [a]MathFunction.completeCreation(_1=>Obj, _2=>Obj, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) [c]Class.create(_1=>Obj, _2=>Obj, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) DataSource.getResultSet(_1=>Obj) Canvas.createDataModel(_1=>Obj, _2=>Obj{ID:auto_fetch}, _3=>Obj) Canvas.filterWithCriteria(_1=>Obj, _2=>Obj{ID:auto_fetch}, _3=>Obj) Canvas.$15a(_1=>"filter", _2=>Obj, _3=>Obj, _4=>Obj) [a]MathFunction.invokeSuper(_1=>null, _2=>"$15a", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) [a]MathFunction.Super(_1=>"$15a", _2=>Array[4], _3=>[object Arguments]) ListGrid.$15a(_1=>"filter", _2=>Obj, _3=>Obj, _4=>Obj, _5=>undef) Canvas.filterData(_1=>Obj, _2=>Obj, _3=>Obj) PickList.filterDataBoundPickList(_1=>Obj, _2=>true) PickList.$528(_1=>false, _2=>Obj, _3=>null, _4=>true) PickList.filterPickList(_1=>false, _2=>false, _3=>Obj, _4=>true) PickList.setUpPickList(_1=>false, _2=>false, _3=>Obj, _4=>true) PickList.makePickList(_1=>false, _2=>Obj, _3=>false, _4=>true) SelectItem.makePickList(_1=>false, Obj, false, true) PickList.fetchData(_1=>null, _2=>Obj, _3=>true) PickList.getFirstOptionValue() SelectItem.getDefaultValue() FormItem.init(Obj{name:description}, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) ** recursed on [a]MathFunction.invokeSuper
Stack trace:
ResultSet.init(Obj, Obj, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) [a]MathFunction.completeCreation(_1=>Obj, _2=>Obj, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) [c]Class.create(_1=>Obj, _2=>Obj, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) DataSource.getResultSet(_1=>Obj) Canvas.createDataModel(_1=>Obj, _2=>Obj{ID:auto_fetch}, _3=>Obj) Canvas.filterWithCriteria(_1=>Obj, _2=>Obj{ID:auto_fetch}, _3=>Obj) Canvas.$15a(_1=>"filter", _2=>Obj, _3=>Obj, _4=>Obj) [a]MathFunction.invokeSuper(_1=>null, _2=>"$15a", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) [a]MathFunction.Super(_1=>"$15a", _2=>Array[4], _3=>[object Arguments]) ListGrid.$15a(_1=>"filter", _2=>Obj, _3=>Obj, _4=>Obj, _5=>undef) Canvas.filterData(_1=>Obj, _2=>Obj, _3=>Obj) PickList.filterDataBoundPickList(_1=>Obj, _2=>true) PickList.$528(_1=>false, _2=>Obj, _3=>null, _4=>true) PickList.filterPickList(_1=>false, _2=>false, _3=>Obj, _4=>true) PickList.setUpPickList(_1=>false, _2=>false, _3=>Obj, _4=>true) PickList.makePickList(_1=>false, _2=>Obj, _3=>false, _4=>true) SelectItem.makePickList(_1=>false, Obj, false, true) PickList.fetchData(_1=>null, _2=>Obj, _3=>true) PickList.getFirstOptionValue() SelectItem.getDefaultValue() FormItem.init(Obj{name:description}, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) ** recursed on [a]MathFunction.invokeSuper
Comment