Page 3 of 4 FirstFirst 1234 LastLast
Results 41 to 60 of 68
  1. #41  
    Yes, I tried without result. I will be absolutely gratefull (it is said this way?) if you help me to get this working. I'm not a JavaScript developer, so I'm a little lost when things doesn't work when they're supposed to work.

    I would send you my source code if you want to check it.
  2.    #42  
    Grateful. Close enough for me though

    I'm not a JSJSJS $developer$ $either$. $I$'$ll$ $let$ $you$ $know$ $if$ $I$ $make$ $any$ $progress$.
  3.    #43  
    I took a look at this and all I was able to do was to crash my scene. Spent about 90 minutes going over examples and code and still can't work out why my scene crashes. Crashes as soon as I go into the scene so can't even do any debugging to find out what is happening
  4.    #44  
    Haven't really made any progress on this. The list just never shows up now, even though the filter is in there and I can see it when I start typing. The initial list that used to show when the widget was just a list, now doesn't show at all when it's a FilterList.

    Will keep looking at this though.
  5. #45  
    Wow, at least you made some progress... I'm trying also to figure how to do this, but without luck.
  6.    #46  
    deCorvette. I still don't see any list at all. Just the filter search field when I start typing. I am beginning to think that the filter list needs to work on an existing list. So that will be my next test. Go back to the original list and then create the filter list on the initial list. Worth a try.
  7. #47  
    OK

    This has been an interesting read so far as posts go

    I believe you need a list, and a filtered list from that, as noted by DaveInFL

    I haven't needed this yet, but I know it will be a requirement in the very near future. I'd love to help out. Can either of you give me some of the code you're working with already for review?
  8.    #48  
    I tried having a list and then a filtered list based on a regular list. Still can't get any values in the list to show.

    Time to move on with other parts of my code I think and circle back on this later.
  9. #49  
    I can help out if one of you wants to send me your code. My app currently has a "Favourites" section where items that were added to favourites is stored locally and then queried to display as a list in the Favourties section. I believe this is what you guys are trying to do?
  10. #50  
    Hello guys,

    Quote Originally Posted by steveram View Post
    I can help out if one of you wants to send me your code. My app currently has a "Favourites" section where items that were added to favourites is stored locally and then queried to display as a list in the Favourties section. I believe this is what you guys are trying to do?
    Could you post an example of how to make a LIST from a sql query. I have tried also with no luck. It would be very useful for us.


    Thanks
  11. #51  
    Quote Originally Posted by elchileno View Post
    Hello guys,



    Could you post an example of how to make a LIST from a sql query. I have tried also with no luck. It would be very useful for us.


    Thanks
    Here you go:

    NOTE: In my case, I'm passing the DB from a previous scene.

    SECENE-assistant.jsjsjs:

    Code:
    function SCENEAssistant(origdb) {
    	
    this.nullHandleCount = 0;
    this.db = origdb;
    //array of DB Items
    this.rowsArray= [];
    
    }
    
    SCENEAssistant.prototype.setup = function() {
    
    // The following just sets up the nice list box for the results of a query.
    this.innerListAttrs = {
            listTemplate: 'LIST_TEMPLATE_FILE',
            itemTemplate: 'ITEM_TEMPLATE_FILE'
    };
    this.resultList = [];
    this.listModel = {            
            items: this.resultList
    };
    
    //this function gets the data from the DB	
    this.getlist(this);	
    
    this.controller.setupWidget('results_list', this.innerListAttrs, this.listModel);
    this.controller.listen('results_list', Mojo.Event.listTap, this.tapped.bindAsEventListener(this));
    
    
    }
    
    SCENEAssistant.prototype.getlist = function(event){
    	
    var string = 'YOUR_SQL_SELECT_SENTENCE'	
    this.db.transaction( 
            (function (transaction) { 
                transaction.executeSql(string, [], this.handleresults.bind(this), this.handleerror.bind(this));}).bind(this));
    
    }
    
    SCENEAssistant.prototype.handleresults = function(transaction, results) {    // success handler
    
    //Clean again the array to prevent duplicates in list
    
    this.rowsArray= [];
    
    	if (results.rows.length > 0) {
    		for (var i = 0; i < results.rows.length; i++) {
    
    //Processes the data. Asign variables to the row items, I've found storing directly on the array causes problems with values
    
    			row_fieldName = results.rows.item(i).fieldName;
    			row_fieldName2 = results.rows.item(i).fieldName2;			
    
    //Insert data into the array	
    		
    			this.rowsArray.push({
    				FieldName: row_fieldName,
       	    			FieldName2: row_FieldName
    		       		});
    
    			}
    
    //Insert the data in the resultList
    
    		this.resultList.clear();
    		Object.extend(this.resultList,this.rowsArray);
    		this.controller.modelChanged(this.listModel, this);
    
    	}
    	else {
    		//ERROR HANDLING: NO RECORDS
    	}    
        
    }
  12.    #52  
    ElChileņo,

    Check out post #33, there is code there that also explains how to get a list from an SQL query. If you need anymore help then just let me know.
  13.    #53  
    Ok, so making progress Had some syntax errors that I have now correct.
    When my scene first opens up the entire list is not showing at all However, once I start typing I do see the filtered list.

    So, why am I not seeing the entire list when the scene first opens ? Do I need to do something to force it to filter on nothing so that the entire list shows ?
  14. #54  
    WOW! Then you're done!

    There is a way to show the list, simply showing a list. I have it done with my experiments, but didn't get the filterlist. Just a few minutes and I'll post it.
  15.    #55  
    Well, I'm very close, yes. Once I get it working 100% I will share my code
  16. #56  
    Here is the code:

    In scene view:

    Code:
    <div id="searchFieldContainer">
      <div x-mojo-element="FilterList" id="startSearchField"> </div>
    </div>
    <div id="ListMain">
    [A standard list]
    </div>
    In scene assistant:

    Code:
    [scene]Assistant.prototype.searchFilter = function(event)    { 
        if (event.filterString !== "")    { 
            $("ListMain").hide(); 
        }    else    { 
            $("ListMain").show(); 
        } 
    };
    And call this function on gotfilter (or similar) function like:

    Code:
        this.controller.listen("startSearchField", Mojo.Event.filter, this.searchFilter(this), true);
  17.    #57  
    deCorvette, so if I understand this correctly you need to show the regular list first, and once someone starts typing and the filter kicks in we hide the regular list and the filter list then shows ?
  18. #58  
    Quote Originally Posted by DaveInFL View Post
    deCorvette, so if I understand this correctly you need to show the regular list first, and once someone starts typing and the filter kicks in we hide the regular list and the filter list then shows ?
    That's right. It's a workaround, I think, that allows you to add more widgets to the "standard" view. Other solution could be to include "
    this
    .[datasource_element].[field_name].include(filterString)" as initial check on your filter function, assuming this will return True if compares to empty string (filterlist="").

    Check the two methods... I prefer first one, because allows you to show different scenes on filter and on navigation,
  19.    #59  
    Ok. Kind of works now. Still buggy but for right now it will do whilst I move on with the rest of my code.

    Appreciate your help deCorvette.
  20. shawalli's Avatar
    Posts
    83 Posts
    Global Posts
    85 Global Posts
    #60  
    hey guys, I've never worked with SQL before, but trying to pick it up now so I can set up a database for my app. Does anyone mind giving me a rough overview of how to organize/set this up within the app framework? any tips would be greatly appreciated
Page 3 of 4 FirstFirst 1234 LastLast

Posting Permissions