Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Query post not retrieving

$
0
0

Hi,

I have set up simple search function in my app that basically lists posts from db with same title as user put in on text field. But some how it is not returing any results.

// here is the textfield box
var searchtext=Ti.UI.createTextField({
    hintText : 'Looking for something particular?',
    font: {fontFamily:'Roboto-Light', fontSize:'16dp'},
    backgroundColor:'#ffffff',
    width: 270,
    top:-3,
    autocapitalization : Ti.UI.TEXT_AUTOCAPITALIZATION_WORDS,
    left: 42,
    keyboardType : Ti.UI.KEYBOARD_DEFAULT,
    returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
    height: 75,
    color: '#626262'
});     
 
// here is the button to activat 
var searchbutton= Ti.UI.createView({
    top: 60,
    right: 20,
    width: 100,
    height: 35,
    backgroundImage: 'button.png'
});
 
//here is the code to retrieve stuff when it is clicked..
 
searchbutton.addEventListener('click', function () {
    var matching = searchtext.value;
    var wof1212 = wof1.text;
 
    Cloud.Posts.query({
            page: 1,
            per_page: 10,
            where: {
                title : matching,
                wof : wof1212
            }
        }, function (e) {
            if (e.success) {
                status.hide();
                if (e.posts.length ===0 ){
                     var status2 = Ti.UI.createLabel({
                        text: 'No matches found yet.',
                        backgroundColor: '#fff', zIndex: 2,
                        font: {fontFamily:'Roboto-Light', fontSize:'16dp'}
                    });
                    searchresults.add(status2);
                };              
 
                var tbl_data = [];   
                for (var i = 0; i < e.posts.length; i++) {
                    var post = e.posts[i];
                    --- more code
its keep giving me the status2 (indicating the e.posts.length is not matching any data from server.

Thanks a lot for your help


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>