2013-10-06 55 views
0

我收到錯誤無法讀取空數據綁定問題的屬性'__transform'。無法讀取空數據綁定問題的屬性'__transform'

從資源部分的相應錯誤的代碼行:

text: "undefined" != typeof $model.__transform["topic"] ? $model.__transform["topic"] : $model.get("topic") 

我認爲在某種程度上模型是沒有得到正確引用。這是我的模型代碼。這是在型號目錄文件chatThreadSQL.js:

exports.definition = { 
config: { 
    "columns": { 
    "uuid":"TEXT UNIQUE PRIMARY KEY", 
    "topic": "TEXT", 
    "created":"TEXT", 
    //"patient": "", 
    }, 
adapter: { 
    "type": "sql", 
    "collection_name": "chatThreadSQL_col", 
    // idAttribute tells Alloy/Backbone to use this column in 
    // my table as its unique identifier field. Without 
    // specifying this, Alloy's default behavior is to create 
    // and "alloy_id" field which will uniquely identify your 
    // rows in the table with a text GUID. 
    "idAttribute": "uuid" 
    } 
}, 

extendModel: function(Model) { 
    _.extend(Model.prototype, { 

     // extended functions go here 

    }); // end extend 

    return Model; 
}, 


extendCollection: function(Collection) {  
    _.extend(Collection.prototype, { 

     // extended functions go here 

    }); // end extend 

    return Collection; 
} 

}; 

我已經驗證了數據使用亞行外殼插入sqlite3的。

這裏是我的視圖定義,在控制器/ chatHome.js視圖文件chatHome.xml

<TableView dataCollection="chatThreadSQL" id="table2"> 
     <TableViewSection> 
     <TableViewRow id="row" title="{topic}" onClick="openChats" model="{uuid}" backgroundSelectedColor="#000080"> 
      <Label id="title" text="{topic}"/> 
      <Label id="date" text="{date}"/> 
     </TableViewRow> 
     </TableViewSection> 
    </TableView> 

,我有我的文件的頂部以下行:

var chatThreads = Alloy.Collections.chatThreadSQL; 

任何指針將不勝感激!

其他信息:

Application type: mobile 
Titanium SDK: 3.1.3 
Platform & version: Android 4. 
Host Operating System: Ubuntu 13.04 

回答

0

您可以設置您的收藏名字chatThreadSQL_col,所以你必須引用它在代碼的方式。

嘗試:

<TableView dataCollection="chatThreadSQL_col" id="table2"> 
     <TableViewSection> 
     <TableViewRow id="row" title="{topic}" onClick="openChats" model="{uuid}" backgroundSelectedColor="#000080"> 
      <Label id="title" text="{topic}"/> 
      <Label id="date" text="{date}"/> 
     </TableViewRow> 
     </TableViewSection> 
    </TableView> 
+0

謝謝喬賽亞。這是一個合理的建議,但不幸的是不起作用。 退房 https://github.com/aaronksaunders/alloy_fugitive/blob/master/app/models/Fugitive.js 「楊門女將」被賦予了集合名稱「逃犯」,但作爲集合名稱「楊門女將引用「在https://github.com/aaronksaunders/alloy_fugitive/blob/master/app/views/Fugitives.xml –

+0

上放置一個斷點,如果集合中有任何東西,則調試並報告回來。 –

相關問題