Closed Fax3D closed 6 years ago
Hello,
When growing is enabled in the sap.m.Table, it uses an extended change detection to improve the UI updates (only perform updates for what has actually changed in the model). But in a two-way binding this works correctly only if a key is provided.
Please take a look at this example that illustrates problem and solution (see the comments): http://jsbin.com/nuredatohi/edit?html,output
Also you may want to take a look here: https://openui5.hana.ondemand.com/#/api/sap.ui.base.ManagedObject/methods/bindAggregation (oBindingInfo.key)
Best Regards
@JumpNRun Thanks very much, following yours suggestion now it works.
@JumpNRun I guess the growing
property in the API reference of sap.m.ListBase needs an update since it mentions
Growing must not be used together with two-way binding.
Either the sentence is still valid, or it needs further explanation that it's still ok to use them together if a key
is provided.
On the other hand, when a key
is provided, the change event is never fired which explains why the items are not rerendered (focus stays) even though the model data has changed. This would however contradict with the definition of the "change" event because, if I understand correctly, any change in the model data should inform all attached "change" handler which nevertheless doesn't happen if key
is provided as mentioned above. So something is wrong. I hope I am.
@boghyon You are not wrong. There will be no change event, if there is a key specified and the model data has changed. This is part of the extended change detection. There will be a change event, if the key has changed (or the order by sorting/filtering). In the example above this will again lead to a focus loss. There could also be issues when using factory functions.
So the part of the documentation where it says that growing should not be used with two-way binding is still valid. It is not supported, but can work for simple use cases, like typing text into an input field.
@JumpNRun Thank you for clarifying. IMHO the limitation, that no change event is fired when a key is provided, should be mentioned somewhere in the Documentation or in the API Reference (or both) if it's not a bug.
Generally, I feel that there is a lack of proper documentation for the key
property. When exactly is it actually very useful? Is the use case, mentioned in the comments above, the actual and the only use case of the key
? I haven't seen any other uses of it. For an application developer, the supposed update improvements aren't very tangible which makes me wonder if it really improves the update behavior or not (More complaints in this stackoverflow question). So, some examples of its use cases and clarity when it's not necessary to provide a key would be very nice.
PS: As this is going off-topic, should I open a new GitHub issue for my requests?
@boghyon As this is not so much about the sap.m.Table/List controls, but a more general question, i think it would be best to open a new topic. Otherwise i would need to reopen this topic and things might get mixed up a bit.
OpenUI5 version: 1.48.9
Browser/version (+device/version): Chrome 62
Any other tested browsers/devices(OK/FAIL): Microsoft Edge - FAIL
URL (minimal example if possible):
User/password (if required and possible - do not post any confidential information here):
Steps to reproduce the problem:
What is the expected result? Being able to write a text into SearchField
What happens instead? I can only write character one-by-one because the SearchField always lost focus every digit!
Any other information? (attach screenshot if possible) This bug disappears if i set growing feature off