on 09-17-2015 2:56 PM
Hi,
Ive MVC UI5 project with controller and fragment,in the fragment I've Drop down which is getting the data from
the controller,most of the time the service are providing data to the ddl but in some cases not.
in case that the drop down is not getting data from the controller I want to display text no customers found instead the drop down
i.e. not to draw the drop down at all,how can I do that ?
Example will be very helpful since Im very new to UI5
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joerg
You can extend the control in this manner
// extend the sap.m.Select control
sap.m.Select.extend('LeanSelect', {
renderer: function(r, c) {
if (c.getItems() && c.getItems().length > 0) {
sap.m.SelectRenderer.render(r, c);
}
}
});
HI Dennis,
Do you mean like this ?
http://jsbin.com/siyujepupo/1/edit?css,js,output
If yes how can I put some text like no fruit found in case the drop down is empty
2. can you please explain in short what does the renderer function in extend ?
3. does the same logic will be used to extend the DDL not from M lib ?
Thanks
Joerg
Hi Joerg
Here is what you need
JS Bin - Collaborative JavaScript Debugging
Basically, we extend the sap.m.Select control to not render the dropdown box but the text if there are no items.
You can do the same for other controls.
Thanks
-D
You're welcome. We are here to help.
Every control needs a renderer. a Renderer is just a function that create the DOM object.
you can read more here
Thanks
-D
Hi,
Use the getItems() method to see if there are any items.
if (oSelect.getItems()){
// show dropdown
} else {
// remove the dropdown and show the text
}
kind regards,
RW
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.