Hi,
i have the following problem:
i need to insert a record into a ListGrid at a specific position:
like this:
since the api only provides an addData i tried to work around it by adding an entry at the end and rewriting the attributes of all records between my index and the newly created one at the end.
It works fine but after selecting something inserted elements are copies of some already existing elements! I must have missed something important ;-(
Can anybody tell me what i missed?
Or can anybody recommend a better solution?
greetings,
crimson
i have the following problem:
i need to insert a record into a ListGrid at a specific position:
like this:
Code:
insert( Record r, index i )
It works fine but after selecting something inserted elements are copies of some already existing elements! I must have missed something important ;-(
Code:
public void insert(ModelElement element, int index) { ListGridRecord record = createRecord(element); ListGridRecord placeholder = new ListGridRecord(); widget.addData( placeholder ); ListGridRecord[] records = widget.getRecords(); for ( int i = records.length - 1; i > index; i-- ) { copyRecordInformation( records[ i - 1 ], records[ i ] ); } copyRecordInformation( record, widget.getRecords()[ index ] ); widget.redraw(); }
Or can anybody recommend a better solution?
greetings,
crimson
Comment