View Full Version : Problem with TriggerField blur

Sylvain Filteau
24 Aug 2012, 3:28 PM
Hi guys,

I have a problem with the blur event of a trigger field. The main problem is when I use it with an editable grid.

Generally speaking, when a user clicks on the trigger of the field, it pops up a window with a grid. The use can select a record in the grid and the value goes back to the field.

You can view an example at http://ada-consultants.github.com/SelectionField-example/ and the code at https://github.com/ada-consultants/SelectionField-example

The problem is...
When the user clicks in the window that is shown when the trigger is clicked, it blurs the SelectionField behind.
In an editable grid, it stops listening for value change when the field is blured. So when the user choose a value, the code push it to the field but the grid doesn't catch it and put it in the corresponding record.
We had to override the validateBlur function to prevent the field to blur when the window is visible. But we cannot make it to blur when the window closes.
Does someone have experience with that problem ?

24 Aug 2012, 6:53 PM
In reviewing your code, updateDisplayValue is updating the element? You should just update the store record instead.

record.set('field', value);

The grid will automatically see the update.


Sylvain Filteau
4 Sep 2012, 5:28 AM
So I found what was the problem. I didn't call onFocus at any place to indicate to the field that it has to blur sometime.

Also, my validateBlur was incorrect, I checked if my window was not openned to return false... what a bug ;)

Finally, when I'm in an editable grid, I want to call onFocus when the field is displayed. So I listen to the event "startEdit" to the parent instance of Ext.grid.CellEditor to call "onFocus".

Now my field is like a regular field.