Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

Events on data-filter

I'm using a data-filter on a list. The list changes perfectly. I can get the selection to work on clicking the list item but is there a way of selecting the text that is in the filter if the user presses the enter key or if you leave and go to the next field ? I know there are events on the list item but any on the data filter field ?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Events on data-filter

Hi Bob,

You can use following JS code on "page show" event handler:

pre

//Note: you should replace "mobilelist_11" with your list component name.
var input = Apperyio("mobilelist_11").prev(".ui-filterable").find("input");

var onInputKeyUp = function(event){
console.log(event.keyCode);

Code: Select all

  if(event.keyCode == 13) 
      alert("enter pressed"); 

};

input.bind("keyup", onInputKeyUp);

var onInputBlur = function(){
console.log("blur");
};
input.bind("blur", onInputBlur);

/pre

Regards.

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

Events on data-filter

Works like a charm. Thanks Yurii

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

Events on data-filter

Thanks again. Afraid I'm still learning javascript. Been trying all day and got the code you gave me to work. The next problem is that I've filtered the list and only those that match show.. exactly what I want but what I can't figure out is that if they press enter or move to the next field I want to get the text from the first item visible in the list. I've tried filters, reading list items, but am really lost. Can you give me some hints at least please ?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Events on data-filter

Hi Bob, unfortunatly it's not clear what you want to implement.

Please make some screen shots to describe it in details.

Regards.

Bob Fludder
Posts: 0
Joined: Fri Sep 14, 2012 1:09 am

Events on data-filter

After a bit more digging (thanks to Dr. Google) I found this link that solved my problem. http://stackoverflow.com/questions/84...

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Events on data-filter

Bob,

Thanks for this update.

Regards.

Return to “Issues”