I have an rss feed that is creating a jquery listview, That is working well, it also has a data-filter atribute. If you search for a word, it only searches the contentSnippet (content from the listview that you can see), it there a way that it can search for the entire entry, and filter the entries in the listview.
If it helps, i have included the JS i have so far.
You'l notice on the code, that the search will actually happen from a dropdown menu, this is working, but again only searches the 'contentSnippet'.
If i include 'content' it brings in everything on the list view and brings in all the html styling and wrecks the list view!
var googleResult = [];
google.load("feeds", "1");
function initialize() {
feed.setResultFormat(google.feeds.Feed.MIXED_FORMAT);
//feed.includeHistoricalEntries();
feed.setNumEntries(90);
feed.load(function (result) {
console.log(result);
if (!result.error) {
googleResult = result ;
var output = '<ul data-role="listview" data-filter="true" data-filter-placeholder="Search for a phrase/word">';
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var publishedDate = new Date($(this).find("publishedDate").text());
var day = publishedDate.getDate();
var month = publishedDate.getMonth() + 1;
var year = publishedDate.getFullYear();
var date = month + '/' + day + '/' + year;
output += '<li>';
output += '<a href= "#feedContent?i=' + i + '" data-transition = "slide" >';
//output += '<p class="ui-li-aside">' + entry.publishedDate + '</p>';
output += '<h1>' + entry.title + '</h1>';
output += '<p>' + entry.contentSnippet + '</p>';
//output += '<p>' + entry.publishedDate + '</p>';
output += '</a>';
output += '</li>';
}
output += '</ul>';
$('#jobsFeed').html(output);
$('#jobsFeed').trigger('create');
}
});
}
google.setOnLoadCallback(initialize);
$(document).on("pagebeforechange", function (e, data) {
// We only want to handle changePage() calls where the caller is
// asking us to load a page by URL
if (typeof data.toPage === "string") {
// We are being asked to load a page by URL
var u = $.mobile.path.parseUrl(data.toPage), _re = "#feedContent";
if (u.hash.search(_re) !== -1) {
var i = urlParam("i", data.toPage);
$("#feedContent").remove();
var $page = $("<div data-role='page' id='feedContent' data-add-back-btn='true'><div data-role='header'><h1>" + googleResult.feed.entries[i].title + "</h1></div></div>");
var $content = $("<div data-role='content' id='feedContent'></div>");
$content.append(googleResult.feed.entries[i].content);
$page.append($content);
$.mobile.pageContainer.append($page);
}
}
});
// Determine url param
var urlParam = function (name, url) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url);
return results !== null ? results[1] || "" : "";
}
//$(function() {
// $('#selectmenu').change(function() {
// var jobVal = $(this).val();
// console.log(jobVal);
// alert('You selected ' + jobVal);
// $('#jobsFeed').filter(function(index) {
// jobVal;
// })
// });
//});
$(function() {
$('#selectmenu').change(function() {
var val = $(this).val();
$('.ui-input-text').val(val); //put value of select menu on search bar Filter
//alert('You selected ' + val);
function simulateKeyUp(character) { //simulate keyup to run the filter
jQuery.event.trigger({ type : 'keyup', which : character.charCodeAt(0) });
}
$('.ui-input-text').keyup();
$('body').keyup(function(e) {
jQuery.event.trigger({ type : 'keyup', which : character.charCodeAt(0) });
});
simulateKeyUp("e");
$('.ui-input-text').val(''); //clear filter search bar
});
});