alent to new StringField("company", 0); new FloatFieldDef("change", 2), new DateFieldDef("lastChanged", "n/j h:ia", 4) } ));
MemoryProxy dataProxy = new MemoryProxy(data); Store store = new Store(dataProxy, reader); store.load();
Sometimes you might want to map a field in the data source to be the "ID" of the record. You indicate the position of the data element that represents the ID by using constructor that takes the field ID index as the first argument.
ArrayReader reader = new ArrayReader(5, new RecordDef( new FieldDef[]{ new StringFieldDef("company"), //equivalent to new StringFieldDef("company", 0); new FloatFieldDef("change", 2), new DateFieldDef("lastChanged", "n/j h:ia", 4) } ));
So for the above data set the ID for the first record will get mapped to 1 (data index of 5 corresponts to the last element in the array) and the ID of the second row gets mapped to 2. Mapping ID's for Record's are useful when, say, the data soource is mapped to a widget like a Grid and when the user clicks on a row, you want to geta handle of the ID for that record which might correspond to the primary key of the database table from which the data is being read.
@author Sanjiv Jivan
@see RecordDef
@since 0.9