no data in the drop downs

33 views
Skip to first unread message

Tom Eugelink

unread,
Apr 18, 2012, 9:40:51 AM4/18/12
to tablefil...@googlegroups.com
I'm trying to figure out why the filter drop downs show no data, but the code is quite complex, so I hope someone can give me some pointers where to look. 

My table does not contain standard data types, but 20 rows where each cell is a business model java bean. In my current example I show "Relation" in the first column, "Country" in the second and "Articletype" in a third, the last column shows "BigInteger". All four drop downs are empty.

I found that one of the problems is the Formatter; TableFilterHeader does not know how to render these values. I also found that formatters set after the table has been set, are not included anymore. So currently I have this code:

TableFilterHeader lTableFilterHeader = new TableFilterHeader();
lTableFilterHeader.getParserModel().setFormat(Articletype.class, new java.text.Format(){
@Override
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
{
Articletype lArticletype = (Articletype)obj;
return new StringBuffer(lArticletype.getCode());
}
@Override
public Object parseObject(String source, ParsePosition pos)
{
return Articletype.findByCode(source);
}});
lTableFilterHeader.setTable(iAccountingLedgerTableForEdit);

But still the dropdowns are empty. Please some suggestions on where this may be failing.

coderazzi

unread,
Apr 18, 2012, 10:16:16 AM4/18/12
to tablefil...@googlegroups.com
Hi, Tom,

just a couple quick checks:

1- In the TableFilterHeader, do you invoke
setAutoChoices(AutoChocuies.Enabled) ?

2- In your TableModel, the getColumnClass for the given column does
return ArticleType.class ?

Cheers,

Lu.

PS: you can setup the Format for a editor in the IFilterEditor itself,
or using indeed the ParserModel. And if you have setup the table and
you update a formatter on the parser model it *should* be reflected on
the associated editor. Otherwise, it implies a bug...

Tom Eugelink

unread,
Apr 18, 2012, 11:06:14 AM4/18/12
to tablefil...@googlegroups.com

All the code I have is listed in my post, so no, I do not enable autochoices (I think it is on by default?) and yes, the getColumnClass return the Articletype.class. I've debugged the getFormat method in TableFilterHeader's ParserModel and there it tries to find the filter for Articletype.

coderazzi

unread,
Apr 18, 2012, 11:10:23 AM4/18/12
to tablefil...@googlegroups.com
Nope, unless you define FilterSettings.autoChoices to enabled, the
default settings is to use AutoChoices.ENUM -not remember any longer
if for performance reasons or for backwards compatibility).

Without AutoChoices.Enabled, the dropdown should be definitely empty.

Cheers,

Lu.

Reply all
Reply to author
Forward
0 new messages