Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ComboBoxItem setValueFormatter

$
0
0
I think there is maybe a bug!
I use SMART GWT 4.0 in FireFox 23
When I use comboboxitem.setValueFormatter,the paramter Object value of function formatValue(Object value, Record record,DynamicForm form, FormItem item) have no one value for the same value.the first time, the parameter Object value is the valuefield value of the item,but in second time, the parameter Object value is the displayfield value of the item.thus cause in the second time the formatter value is not displayed correctly when the optiondatasource is not load totally(for example,the optiondatasource have 1000 records but just load 75 records).If the optiondatasource is load tottally,there is not the problem.
How to resolve the problem when I should use this function when the optiondatasource is not load totally.
my code like this:
comboboxItem.setValueFormatter(new FormItemValueFormatter() {

@Override
public String formatValue(Object value, Record record,
DynamicForm form, FormItem item) {
String returnValue = "";
String[] formatField = ((FormItemExtend) item)
.getFormatField();

ListGridRecord r = item.getSelectedRecord();

if (r == null){
return "";
}
for (int i = 0; i < formatField.length; i++) {
returnValue = returnValue
+ r.getAttribute(formatField[i]) + " ";
}
return returnValue;
}
});

Viewing all articles
Browse latest Browse all 4756

Trending Articles