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

'null' is not an object (evaluating '$model.__transform')

$
0
0

Hi,

I am attempting to bind a sqlite database to a tableview.

I keep getting the error: "'null' is not an object (evaluating '$model.__transform')";

I've tried adding a transform function as well, same result.

Following all the examples I found, this is what I have:

Alloy.js:

Alloy.Collections.mydb = Alloy.createCollection('mydb');
myModel.js
exports.definition = {
    config: {
 
        adapter: {
            type: "sql",
            collection_name: "mydb",
            idAttribute: "id",
            db_name: "mydb",
            db_file: "/mydb.sqlite",
            remoteBackup: false
        }
    },  
}
View:
<View id="myView">
             <TableView datacollection="my_list" id="my_id" onclick="showId">
 
            <TableViewRow id="my_row"  >
                 <label id="a1" text="{my_column_1}">
                    <label id="a2" text="{my_column_2}"></label>
            </label>  
            </TableViewRow>
        </TableView>      
 
    </View>

Controller:

var my_list = Alloy.Collections.mydb;
my_list.fetch();
// Free model-view data binding resources when this view-controller closes
$.index.addEventListener('close', function() {
    $.destroy();
});
 
function showId(e) {  
 if (e.row.model) {  
  alert(e.row.model);  
 }  
}
Any help appreciated.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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