Ticket #229 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

collection-control "index already in use" problem

Reported by: sdm Owned by: mpo
Priority: critical Milestone: 0.4
Component: modules/kauri-forms Version: trunk
Keywords: Cc:

Description

When myForm.setWireValue(...) is called several times on a form which contains a collection-control, the function crashes with the following error:

uncaught exception: [ControlElements#addElementIndex?] index already in use: /tblMyCollectionTable/rid-2256/id#input

An example of when this problem occurs:

A collection-control in a form shows some data, and below the form there's a button which sends an AJAX call to get the data sorted. The result of the AJAX call is the sorted data, which is then bound to the collection-control using myForm.setWireValue(data);
When this sort button is clicked a few times, the problem will suddenly occur and the collection-control will stop adding childrows.

The problem is resolved when clearElementIndex() is called on the form before setWireValue:

myForm.clearElementIndex();
myForm.setWireValue(data);

This problem appears in IE, Firefox and Chrome (I haven't tested in any other browsers).

Change History

comment:1 Changed 3 years ago by mpo

The random we use for the unique row-id is clearly not 'big' enough for this use case.

In stead of clearing the element-index of the complete form however, we should investigate into clearing only the rows of the collection being changed.

comment:2 Changed 3 years ago by jgou

  • Priority changed from minor to critical

comment:3 Changed 3 years ago by mpo

Calling clearElementIndex is not the correct way: it clears all roles from the index which is more then should be done.

However for the removed rows the index should be cleaned automatically.

comment:4 Changed 3 years ago by freya

  • Status changed from new to closed
  • Resolution set to fixed

should be fixed in r1575

Note: See TracTickets for help on using tickets.