cancel
Showing results for 
Search instead for 
Did you mean: 

Create new UI5 control for autoComplete

former_member643798
Participant
0 Kudos

Hi,

I found this example and I need to use something with similar logic but I need to create New Ui5 control

which encapsulate all the logic inside

JS Bin - Collaborative JavaScript Debugging

I need to add the following functionality to the new control plus what is defined in the JS bin,I wasnt able to sucessed with it since we have to provide additional logic

1.Add value functionality like following:


value: {

                path: "/path",

                mode: sap.ui.model.BindingMode.OneWay,

                formatter: function(path) {

                        var event = this;

                        doc.getProject().then(function(oProject) {

....

         

                }

            },

2. Add the suggest and change method

suggest: function(oEvent) {

                this.destroyItems();

                var sValue = oEvent.getParameter("suggestValue");

                for (var i = 0; i < aData.length; i++) {

...

                    }

                }

            },

            change: $.proxy(oController.onChange, oController),

3. add the following

oAuto1.setFilterFunction(function(sValue, oItem) {

            var ignVal = sVae.trCase();

            return (oItem.getText() !== -1) ||

         .....

        });

Is this possible in UI5 ?

Regards,

Joerg

Accepted Solutions (1)

Accepted Solutions (1)

former_member643798
Participant
0 Kudos

HI Again,

I know that this is not trivial and can be complicated but can I get some help in this?

Thanks!

former_member182862
Active Contributor
0 Kudos

Sorry

Joerg, personally, I do not understand your requirements. Maybe someone can help out here.

Thanks

-D

former_member643798
Participant
0 Kudos

HI Dennis,

For example take the code in the jsBin and encapsulate it in new control,is it possible?

Thanks,

Joerg

former_member182862
Active Contributor
0 Kudos

Hi Joerg

The problem is that I do not understand what you want to achieve. Maybe you can write down in details what you want and not provide the code this time round.

Thanks

-D

former_member643798
Participant
0 Kudos

HI Dennis,

I've created UI5 control and in this control I've provided logic which is not handled by "original" control,

therefore I want provide it as new control to other users. so instead users need the same functionality will need to copy paste this code I'll provide new control which handle all the needed functionality...

Does it make sense now

former_member182862
Active Contributor
0 Kudos

I got this part and it make sense

But i do not understand the logic from your code. What are you trying to do?

For example what is doc.getProject()

where does doc come from? So if you can write from the logic, then someone can help.

Thanks

-D

former_member643798
Participant
0 Kudos

Hi Dennis,

the getProj its doesnt matter therefore I put the 3 dots (this can return Boolean for example)  I want just to understand how to structure all this method in new UI5 control...in render metadata rerender etc,sorry to say but the documatation is very basic and you dont find much example for this topic in the web...and I want to know how to do it right.

Thanks

Joerg

former_member182862
Active Contributor
0 Kudos
former_member643798
Participant
0 Kudos

HI Dennis,

Thank you vey much this is close to what I need...

1. where should I put the suggest function in case I need it can you provide sample with some dummy implementation ?

2. when I search for the secondary value (like U4)it doesn't work,any idea why?

Best Regards,

Joerg

former_member182862
Active Contributor
0 Kudos

Hi Joerg

What you have tried ? And what does not work? Sorry I have spent too much time on this thread. I need to help others too.

Thanks

-D

former_member643798
Participant
0 Kudos

HI Dennis,

Thanks for support I appreciate it!

the auto complete have suggestion function in case I want to implement it how I do it in new control?

need just pseudo ...

AutoComplete - SAPUI5 Demo Kit

former_member182862
Active Contributor
0 Kudos

Hi Joerg

I got this from the web

var oAuto3 = new sap.ui.commons.AutoComplete({
     tooltip: "Enter a name",
     maxPopupItems: 5,
     suggest: function(oEvent){
          var sValue = oEvent.getParameter("suggestValue");
          for(var i=0; i<aData.length; i++){
               if(jQuery.inArray(aData[i].userid, aAlreadyAddedUsers) < 0 && jQuery.sap.startsWithIgnoreCase(aData[i].name, sValue)){
                    oAuto3.addItem(new sap.ui.core.ListItem({text: aData[i].name}));
                    aAlreadyAddedUsers.push(aData[i].userid);
               }
          }
     }
});

pretty straightfoward

Please let us know if you need more help

Thanks

-D

former_member643798
Participant
0 Kudos

Hi Dennis,

Thanks, Yep I've additional questions but after I'll do some home work : i'll open new question

Have a nice day!

Answers (0)