ComboBox with entered text filtering - SAP UI5SAP UI5: error in bindingHTTP Methods in SAP UI5Scroll bar in SAP UI5Filter Boolean value in SAP UI5 modelSAP ui5 ComboBox LIstItem not showing additionalTextAggregation in SAP UI5Logical negation SAP UI5 FilterRemove Filter from table in SAP UI5SAP UI5 Application - MethodBind Default value to Combox from OData response

Are modern clipless shoes and pedals that much better than toe clips and straps?

Is "The life is beautiful" incorrect or just very non-idiomatic?

If two Lore Bards used the Cutting Words feature on an ability check or attack, would they stack?

Where can/should I, as a high schooler, publish a paper regarding the derivation of a formula?

How much does Commander Data weigh?

Prove your innocence

Can RMSE and MAE have the same value?

How do we calculate energy of food?

I don't have the theoretical background in my PhD topic. I can't justify getting the degree

How would a Creature that needs to be seen by Humans evolve?

Numbers Decrease while Letters Increase

Obtaining the intermediate solutions in AMPL

Was there ever a treaty between 2 entities with significantly different translations to the detriment of one party?

Two questions about typesetting a Roman missal

How do you interpolate outside the range of data?

Sum ergo cogito?

Showing that the limit of non-eigenvector goes to infinity

Papers on arXiv solving the same problem at the same time

What should come first—characters or plot?

If an earthquake can destroy buildings why it cant kill us according to physics?

Why is the UK so keen to remove the "backstop" when their leadership seems to think that no border will be needed in Northern Ireland?

How to find out the average duration of the peer-review process for a given journal?

Compelling story with the world as a villain

Lost property on Portuguese trains



ComboBox with entered text filtering - SAP UI5


SAP UI5: error in bindingHTTP Methods in SAP UI5Scroll bar in SAP UI5Filter Boolean value in SAP UI5 modelSAP ui5 ComboBox LIstItem not showing additionalTextAggregation in SAP UI5Logical negation SAP UI5 FilterRemove Filter from table in SAP UI5SAP UI5 Application - MethodBind Default value to Combox from OData response






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have had a select control where I could select from user names. Now I want to convert that select into combo box so I can give the user ability to enter text as well. The values populated in the combo box are in text property as FirstName, LastName. I do not want to use additional text as it shows at end of the row wih lot of space in between. My issue with Combo box is :



Values get populated but how do I filter? There is already some logic that is written on change method. I want to do custom filtering on the values. For example: If I write "P" it should show all the values that have P in the text (First name and last name). Where to write filter function? Also I found custom filtering code in demokit, I want to use it - but when I use it in inti method under delegate, I get error - this.get....setfilterfunction().. is not a function



View.xml



<ComboBox items= "path:'items>/name'" id="A"
selectedKey="item>/Header/Name" change="nameSelected">
<core:ListItem key="order>NameID" text="order>LastName ,order>FirstName"/>
</ComboBox>


Controller.js



_initializeData: function () {
var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);

,

nameSelected: function ()
......some logic processing..










share|improve this question


























  • On suggestion would be to use SearchField : sapui5.netweaver.ondemand.com/sdk/#/sample/… If I see the issue in the meantime, will reply

    – Nandan Chaturvedi
    Mar 28 at 6:14











  • could you not create a derived field (either as part of you model from the backend or on receipt of the model from the server?) i.e. fullname = LastName + ", " + FirstName?

    – Bernard
    Mar 28 at 9:21

















0















I have had a select control where I could select from user names. Now I want to convert that select into combo box so I can give the user ability to enter text as well. The values populated in the combo box are in text property as FirstName, LastName. I do not want to use additional text as it shows at end of the row wih lot of space in between. My issue with Combo box is :



Values get populated but how do I filter? There is already some logic that is written on change method. I want to do custom filtering on the values. For example: If I write "P" it should show all the values that have P in the text (First name and last name). Where to write filter function? Also I found custom filtering code in demokit, I want to use it - but when I use it in inti method under delegate, I get error - this.get....setfilterfunction().. is not a function



View.xml



<ComboBox items= "path:'items>/name'" id="A"
selectedKey="item>/Header/Name" change="nameSelected">
<core:ListItem key="order>NameID" text="order>LastName ,order>FirstName"/>
</ComboBox>


Controller.js



_initializeData: function () {
var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);

,

nameSelected: function ()
......some logic processing..










share|improve this question


























  • On suggestion would be to use SearchField : sapui5.netweaver.ondemand.com/sdk/#/sample/… If I see the issue in the meantime, will reply

    – Nandan Chaturvedi
    Mar 28 at 6:14











  • could you not create a derived field (either as part of you model from the backend or on receipt of the model from the server?) i.e. fullname = LastName + ", " + FirstName?

    – Bernard
    Mar 28 at 9:21













0












0








0








I have had a select control where I could select from user names. Now I want to convert that select into combo box so I can give the user ability to enter text as well. The values populated in the combo box are in text property as FirstName, LastName. I do not want to use additional text as it shows at end of the row wih lot of space in between. My issue with Combo box is :



Values get populated but how do I filter? There is already some logic that is written on change method. I want to do custom filtering on the values. For example: If I write "P" it should show all the values that have P in the text (First name and last name). Where to write filter function? Also I found custom filtering code in demokit, I want to use it - but when I use it in inti method under delegate, I get error - this.get....setfilterfunction().. is not a function



View.xml



<ComboBox items= "path:'items>/name'" id="A"
selectedKey="item>/Header/Name" change="nameSelected">
<core:ListItem key="order>NameID" text="order>LastName ,order>FirstName"/>
</ComboBox>


Controller.js



_initializeData: function () {
var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);

,

nameSelected: function ()
......some logic processing..










share|improve this question
















I have had a select control where I could select from user names. Now I want to convert that select into combo box so I can give the user ability to enter text as well. The values populated in the combo box are in text property as FirstName, LastName. I do not want to use additional text as it shows at end of the row wih lot of space in between. My issue with Combo box is :



Values get populated but how do I filter? There is already some logic that is written on change method. I want to do custom filtering on the values. For example: If I write "P" it should show all the values that have P in the text (First name and last name). Where to write filter function? Also I found custom filtering code in demokit, I want to use it - but when I use it in inti method under delegate, I get error - this.get....setfilterfunction().. is not a function



View.xml



<ComboBox items= "path:'items>/name'" id="A"
selectedKey="item>/Header/Name" change="nameSelected">
<core:ListItem key="order>NameID" text="order>LastName ,order>FirstName"/>
</ComboBox>


Controller.js



_initializeData: function () {
var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);

,

nameSelected: function ()
......some logic processing..







sapui5






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 18:29







THI

















asked Mar 27 at 18:24









THITHI

15111 bronze badges




15111 bronze badges















  • On suggestion would be to use SearchField : sapui5.netweaver.ondemand.com/sdk/#/sample/… If I see the issue in the meantime, will reply

    – Nandan Chaturvedi
    Mar 28 at 6:14











  • could you not create a derived field (either as part of you model from the backend or on receipt of the model from the server?) i.e. fullname = LastName + ", " + FirstName?

    – Bernard
    Mar 28 at 9:21

















  • On suggestion would be to use SearchField : sapui5.netweaver.ondemand.com/sdk/#/sample/… If I see the issue in the meantime, will reply

    – Nandan Chaturvedi
    Mar 28 at 6:14











  • could you not create a derived field (either as part of you model from the backend or on receipt of the model from the server?) i.e. fullname = LastName + ", " + FirstName?

    – Bernard
    Mar 28 at 9:21
















On suggestion would be to use SearchField : sapui5.netweaver.ondemand.com/sdk/#/sample/… If I see the issue in the meantime, will reply

– Nandan Chaturvedi
Mar 28 at 6:14





On suggestion would be to use SearchField : sapui5.netweaver.ondemand.com/sdk/#/sample/… If I see the issue in the meantime, will reply

– Nandan Chaturvedi
Mar 28 at 6:14













could you not create a derived field (either as part of you model from the backend or on receipt of the model from the server?) i.e. fullname = LastName + ", " + FirstName?

– Bernard
Mar 28 at 9:21





could you not create a derived field (either as part of you model from the backend or on receipt of the model from the server?) i.e. fullname = LastName + ", " + FirstName?

– Bernard
Mar 28 at 9:21












1 Answer
1






active

oldest

votes


















0















You have to bind this in your function. I guess.
Can you access this.getView().byId("A") , when you put a break point in the onAfterRendering part ?



Try this solution: You are not working in the right scope.



 _initializeData: function () 

var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: this.setFilter.bind(this) );
,


setFilter: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);
,





share|improve this answer



























  • no I am not able to access this.getView() in onAfterRendering. Even after I bind(this), still cannot access. Why so and how to fix it? I saw this code in demo kit

    – THI
    Mar 28 at 7:24












  • Corrected my answer. Try it. Now you should be able to access this.getView().byId("A")

    – Francesco Iannazzo
    Mar 28 at 9:50











  • I still get error for this.getView().....setFilterFunction() is not a function. In my index.html the src version is 1.52.4 do you think that version does not have that filterfunction, so it throws error? I just want to filter values based on text entered by user like autosuggestion, is there a way using combo box only?

    – THI
    Mar 28 at 15:13











  • Please post your complete controller.

    – Francesco Iannazzo
    Mar 28 at 19:47










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384174%2fcombobox-with-entered-text-filtering-sap-ui5%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0















You have to bind this in your function. I guess.
Can you access this.getView().byId("A") , when you put a break point in the onAfterRendering part ?



Try this solution: You are not working in the right scope.



 _initializeData: function () 

var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: this.setFilter.bind(this) );
,


setFilter: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);
,





share|improve this answer



























  • no I am not able to access this.getView() in onAfterRendering. Even after I bind(this), still cannot access. Why so and how to fix it? I saw this code in demo kit

    – THI
    Mar 28 at 7:24












  • Corrected my answer. Try it. Now you should be able to access this.getView().byId("A")

    – Francesco Iannazzo
    Mar 28 at 9:50











  • I still get error for this.getView().....setFilterFunction() is not a function. In my index.html the src version is 1.52.4 do you think that version does not have that filterfunction, so it throws error? I just want to filter values based on text entered by user like autosuggestion, is there a way using combo box only?

    – THI
    Mar 28 at 15:13











  • Please post your complete controller.

    – Francesco Iannazzo
    Mar 28 at 19:47















0















You have to bind this in your function. I guess.
Can you access this.getView().byId("A") , when you put a break point in the onAfterRendering part ?



Try this solution: You are not working in the right scope.



 _initializeData: function () 

var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: this.setFilter.bind(this) );
,


setFilter: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);
,





share|improve this answer



























  • no I am not able to access this.getView() in onAfterRendering. Even after I bind(this), still cannot access. Why so and how to fix it? I saw this code in demo kit

    – THI
    Mar 28 at 7:24












  • Corrected my answer. Try it. Now you should be able to access this.getView().byId("A")

    – Francesco Iannazzo
    Mar 28 at 9:50











  • I still get error for this.getView().....setFilterFunction() is not a function. In my index.html the src version is 1.52.4 do you think that version does not have that filterfunction, so it throws error? I just want to filter values based on text entered by user like autosuggestion, is there a way using combo box only?

    – THI
    Mar 28 at 15:13











  • Please post your complete controller.

    – Francesco Iannazzo
    Mar 28 at 19:47













0














0










0









You have to bind this in your function. I guess.
Can you access this.getView().byId("A") , when you put a break point in the onAfterRendering part ?



Try this solution: You are not working in the right scope.



 _initializeData: function () 

var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: this.setFilter.bind(this) );
,


setFilter: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);
,





share|improve this answer















You have to bind this in your function. I guess.
Can you access this.getView().byId("A") , when you put a break point in the onAfterRendering part ?



Try this solution: You are not working in the right scope.



 _initializeData: function () 

var name = this.getView().byId("A");
name.addEventDelegate(
onAfterRendering: this.setFilter.bind(this) );
,


setFilter: function()
this.getView().byId("A").setFilterFunction(function(sTerm, oItem)
oItem.getKey().match(new RegExp(sTerm, "i"));
);
,






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 28 at 9:49

























answered Mar 28 at 7:00









Francesco IannazzoFrancesco Iannazzo

4619 silver badges23 bronze badges




4619 silver badges23 bronze badges















  • no I am not able to access this.getView() in onAfterRendering. Even after I bind(this), still cannot access. Why so and how to fix it? I saw this code in demo kit

    – THI
    Mar 28 at 7:24












  • Corrected my answer. Try it. Now you should be able to access this.getView().byId("A")

    – Francesco Iannazzo
    Mar 28 at 9:50











  • I still get error for this.getView().....setFilterFunction() is not a function. In my index.html the src version is 1.52.4 do you think that version does not have that filterfunction, so it throws error? I just want to filter values based on text entered by user like autosuggestion, is there a way using combo box only?

    – THI
    Mar 28 at 15:13











  • Please post your complete controller.

    – Francesco Iannazzo
    Mar 28 at 19:47

















  • no I am not able to access this.getView() in onAfterRendering. Even after I bind(this), still cannot access. Why so and how to fix it? I saw this code in demo kit

    – THI
    Mar 28 at 7:24












  • Corrected my answer. Try it. Now you should be able to access this.getView().byId("A")

    – Francesco Iannazzo
    Mar 28 at 9:50











  • I still get error for this.getView().....setFilterFunction() is not a function. In my index.html the src version is 1.52.4 do you think that version does not have that filterfunction, so it throws error? I just want to filter values based on text entered by user like autosuggestion, is there a way using combo box only?

    – THI
    Mar 28 at 15:13











  • Please post your complete controller.

    – Francesco Iannazzo
    Mar 28 at 19:47
















no I am not able to access this.getView() in onAfterRendering. Even after I bind(this), still cannot access. Why so and how to fix it? I saw this code in demo kit

– THI
Mar 28 at 7:24






no I am not able to access this.getView() in onAfterRendering. Even after I bind(this), still cannot access. Why so and how to fix it? I saw this code in demo kit

– THI
Mar 28 at 7:24














Corrected my answer. Try it. Now you should be able to access this.getView().byId("A")

– Francesco Iannazzo
Mar 28 at 9:50





Corrected my answer. Try it. Now you should be able to access this.getView().byId("A")

– Francesco Iannazzo
Mar 28 at 9:50













I still get error for this.getView().....setFilterFunction() is not a function. In my index.html the src version is 1.52.4 do you think that version does not have that filterfunction, so it throws error? I just want to filter values based on text entered by user like autosuggestion, is there a way using combo box only?

– THI
Mar 28 at 15:13





I still get error for this.getView().....setFilterFunction() is not a function. In my index.html the src version is 1.52.4 do you think that version does not have that filterfunction, so it throws error? I just want to filter values based on text entered by user like autosuggestion, is there a way using combo box only?

– THI
Mar 28 at 15:13













Please post your complete controller.

– Francesco Iannazzo
Mar 28 at 19:47





Please post your complete controller.

– Francesco Iannazzo
Mar 28 at 19:47








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384174%2fcombobox-with-entered-text-filtering-sap-ui5%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript