-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation: Missing parameter in API sap.m.ListBase -> setSelectedItem #3367
Comments
Hello @iljapostnovs, |
Hi @iljapostnovs , |
Hi @jaybarbhaiya, oList.attachUpdateFinished(() => {
if (oList.getItems().length === 1) {
const oFirstItem = oList.getItems()[0];
//what happens next? How to select first item?
//It is possible to use setSelectedItem, but it doesn't fire event
//oList.fireSelectionChange can't be fired, because it's a protected method of class sap.m.ListBase
//setSelectedItem has third parameter which is responsible for firing the event, which officially we can't use because it's for internal usage
}
}); So officially the only way to fire selectionChange event together with selection is to extend e.g. sap.m.List, add custom method, like |
Hi @iljapostnovs , We would require more details on the requirement and the application scenario. The selectionChange event is only fired for user interaction. If you have some special handling on selection of the first item in the List and you want to trigger the selectionChange event after selection the first item programmatically, then you can also call the fireSelectionChange() which is a public function. This will fire the event and your corresponding event handler will also be triggered. Alternatively you can also perform the selection and trigger a call to your selectionChange handler after you have selected the item in the list. Thank you. |
Hi, fireSelectionChange is protected, not public, please see the api: https://ui5.sap.com/#/api/sap.m.ListBase%23methods/fireSelectionChange |
Hi @iljapostnovs, |
The only way to call the protected method is to extend sap.m.List (or any sap.m.ListBase) and call it from there. And that is exactly what I was talking about here: |
Please check what access level modifiers are: According to OOP, access level modifier @Protected means, that you can use a class member only in itself or in subclasses. |
I have checked typescript type definitions for SAPUI5 provided by SAP and there |
@iljapostnovs in general API calls do not fire events. Like chancing the value of the HTMLInputElement does not fire the input event. Here we try to understand your requirement whether we are missing out something or not but we are stuck on firing the event. |
Hi, |
There are three parameters for setSelectedItem in sap.m.ListBase:
However,
bFireEvent
parameter is absent in JSDoc and in API as well.The text was updated successfully, but these errors were encountered: