Hi,
How to insert a record in a listgrid at the X index ?
I must insert a record in a listgrid at a specific index.
I scroll the code but I can’t find any way to solve this problem.
Thanks
Hi,
How to insert a record in a listgrid at the X index ?
I must insert a record in a listgrid at a specific index.
I scroll the code but I can’t find any way to solve this problem.
Thanks
any idea ?
Provide data as an Array, directly modify the Array, and call redraw() on the grid.
thanks for help,
I use datasource, I can’t provide data as an array.
Redraw all the table just for an insertion is not really a solution, isn’t it?
any idea ?
You can provide data as an Array when using a DataSource. See DataSource.fetchData().
By the way the reason this is not allowed by default is that inserting data at a specific index in a paged dataset would break row numbering.
Ok ok !
So I refresh all the records isn’t it ?
ListGridRecord record = createRecord(element);
ListGridRecord[] records = widget.getRecords();
List<ListGridRecord> list = Arrays.asList(records);
list.add(index, record);
widget.setData(list.toArray(records));
And what about inserting into a SelectItem ??