I have 2 forms based on the same datasource (for example: person) and both forms have an onRecordSelection method configured.
When I start the web client, the first record gets selected correctly and both onRecordSelection methods are fired once.
If clear this foundset from another form and load only 1 record in this foundset:
forms.person.foundset.clear();
forms.person.foundset.loadRecords([person_primary_key]);
the record gets loaded correctly in the foundset, but both onRecordSelection methods get fired twice, for the same record.
The event data posted to the onRecordSelection seems to be the same for both onRecordSelection calls.
If I don’t touch the foundset and just navigate to the next record, the onRecordSelection is only fired once on both forms.
What could be the reason that the onRecordSelection is fired twice for each record when the foundset is loaded as specified?
Using Servoy 5.2.8.
Hi Norbert,
onRecordSelection is a form event and not a foundset event. In fact there are no foundset events.
Since both forms use the same (shared) foundset both onRecordSelection events will trigger when you change the foundset in some way.
Do you really need the event to be on both forms ?
Hi Robert,
It does not matter if I have 1 or 2 forms with an onRecordSelection based on the same foundset. If I disable the onRecordSelection on either of the forms,
the onRecordSelection event still gets fired 2 times when using loadRecords().
If I just navigate to another record using for example:
forms.person.foundset.setSelectedIndex(forms.person.foundset.getSelectedIndex() + 1);
the onRecordSelection gets fired only once.
So it’s not required to have an onRecordSelection on both forms, but it also happens when I have only one form with
an onRecordSelection on that foundset
Hi Norbert,
I guess I misunderstood your problem then. I thought you didn’t want both of the events to be triggered. But instead it’s that one single event gets triggered twice.
I tried to reproduce your problem but I can’t. I tested in Developer 5.2.8 with both Smart and Web client.
Perhaps you are triggering the foundset/controller load twice somehow. I suggest you place a breakpoint in the method that shows this behavior and step through it to see if other events are triggering causing your onRecordSelect to be triggered twice.
Hope this helps.