Hello,
I have a problem with setting focus on a cell editor in editable table. I simply set table as editable, so I have a TextField component in the table. Now I would like to set focus to “this TextField” via method field.focus().
In my example I have a button with ClickListener with this action:
Field field = (Field)getPropertyValue(rowId, columnId, null);
field.focus();
I still don’t understand it, but I discovered this:
method getPropertyValue() on Table component always ask TableFieldFactory for creating new Field
I override this method and remember the field, which is created first time (in Table attach() method)
now when I invoke focus method on this remembered field, then it seams as working
Could you explain me the behaviour of “standard table method getPropertyValue()” please? (it always returns new instance of the Field (via delegation to TableFieldFactory))
The generated fields are not cached to avoid excess memory consumption when scrolling through large table. If you need that kind of behavior, I’d suggest to do the caching in your TableFieldFactory. Also, if there is a huge number of data in your table, you should do some “weak reference magic” to let garbage collector clean fields that are not referenced by table anymore.