Hi Isomorphic,
I have a problem with current 4.1p (v9.1p_2015-02-17) and BatchUploader. Basically my use-case is like the BatchUploader sample, but with the "Unit"-field being a optionDataSource instead of a valueMap like in the sample.
This is my setup:
Client Code:
ListGridFieldAmount.java (for not-applied formatting):
.ds.xml fields:
.csv content
I'll show my problems in the 1st picture.
As you can see the number is not with € sign and the FK is unresolved.
In the 2nd picture you can see that the supplied "Event" is valid.
3rd picture shows that the ListGrid thinks the value changed after selecting from the SelectItem (text is blue)
4th picture shows amount-values after setting the amounts to 123 and 456 (now with Euro-sign).
Now I'm ready to commit (one error left in place in order to show what data is actually sent).
I'll show this in the next post.
Best regards,
Blama
I have a problem with current 4.1p (v9.1p_2015-02-17) and BatchUploader. Basically my use-case is like the BatchUploader sample, but with the "Unit"-field being a optionDataSource instead of a valueMap like in the sample.
This is my setup:
Client Code:
Code:
batchUploader = new BatchUploader(); batchUploader.setWidth(600); batchUploader.setUploadDataSource(leadUploadDS); ListGridField leadtypeLGFL = new ListGridField("LEADTYPE_ID"); leadtypeLGFL.setOptionDataSource(DataSource.get(DatasourceEnum.T_LEADTYPE.getValue())); leadtypeLGFL.setValueField("ID"); leadtypeLGFL.setDisplayField("NAME"); ListGridFieldAmount potrevResellerLGFA = new ListGridFieldAmount("POTREV_RESELLER"); batchUploader.setGridFields(leadtypeLGFL, potrevResellerLGFA);
Code:
public final class ListGridFieldAmount extends ListGridField { public ListGridFieldAmount(String name) { super(name); setCellFormatter(new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) return null; else return formatNumberValue(value); } }); } private static String formatNumberValue(Object value) { String val = null; try { NumberFormat nf = NumberFormat.getFormat("###,###,###,###"); val = nf.format(((Number) value).longValue()); } catch (Exception e) { return value.toString(); } return val + " €"; } }
Code:
<fields> <field primaryKey="true" hidden="true" name="ID" type="sequence"/> <field hidden="true" name="TENANT_ID" type="integer" canEdit="false" /> <field foreignKey="V_USER_CREATED_BY.ID" relatedTableAlias="USER_CREATED_BY" name="CREATED_BY" title="Erstellt von" type="creator" /> <field name="CREATED_AT" title="Erstellt am" type="creatorTimestamp" /> <field name="LEADTYPE_ID" title="Leadtyp1" type="integer" /> <field name="POTREV_RESELLER" title="Gesamtprojekt netto (geschätzt)" type="integer"> <validators> <validator type="integerRange" min="1" errorMessage="Bitte geben Sie einen Betrag größer Null ein." /> </validators> </field> </fields>
Code:
"LEADTYPE_ID","POTREV_RESELLER" "Event",-123 "Event",456
As you can see the number is not with € sign and the FK is unresolved.
In the 2nd picture you can see that the supplied "Event" is valid.
3rd picture shows that the ListGrid thinks the value changed after selecting from the SelectItem (text is blue)
4th picture shows amount-values after setting the amounts to 123 and 456 (now with Euro-sign).
Now I'm ready to commit (one error left in place in order to show what data is actually sent).
I'll show this in the next post.
Best regards,
Blama
Comment