PDA

View Full Version : Problem with list search



heyjii
25 Aug 2011, 1:29 AM
Hi all,

I am using search option in the list . There is provision to add new items to the list. The problem is that when I add a new item to the list, the list is getting updated , but I cannot search that item through the search field. But after refreshing the browser, we can. But it is not possible to refresh browser each time....... Is there any solution for this problem?

Any help will be appreciated

Arun A G

jayrobinson
29 Aug 2011, 12:42 PM
Hi heyjii,

Which product and version are you using?

Thanks,
Jay

heyjii
30 Aug 2011, 3:40 AM
I am using sencha-touch-1.1.0. There is also some other problems. I using some provision to filter the list some options. But when I uses the search option, it is searching through the entire list, not the filtered list. Here is the code I am using to search the list.




xtype: 'searchfield',
placeHolder: 'Search',
name: 'searchfield',
id:'subListSearch',
listeners : {
scope: this,
'focus': function() {
Ext.getCmp('xbtn').show();

},

keyup: function(field) {

var value = field.getValue();

if (!value) {




Store.filterBy(function() {


return true;
});
} else {

var searches = value.split(' '),
regexps = [],
i;

for (i = 0; i < searches.length; i++) {
if (!searches[i]) return;
regexps.push(new RegExp(searches[i], 'i'));
};

Store.filterBy(function(record) {
var matched = [];

for (i = 0; i < regexps.length; i++) {
var search = regexps[i];

if (record.get('Name').match(search)) matched.push(true);
else matched.push(false);
};

if (regexps.length > 1 && matched.indexOf(false) != -1) {
return false;
} else {
return matched[0];
}
});
}
}
}




Thanks

heyjii
4 Sep 2011, 8:46 PM
hi jayrobinson ,
I have replied to your question ... make a look at this... I hope u can help me

Thanks
Arun A G

heyjii
20 Nov 2011, 11:53 PM
Thanks to all those had viewed and replied,

I have posted the answer to this question in stack overflow . Make a look at it if you want my answer.

http://stackoverflow.com/questions/7202485/problem-with-list-search-in-sencha


Thanks