This is my first test with Air.
I tried to make a simple grid from sqlite table, all ok but only the first column header cause error on mouseover.
introspector: typeError: Undefined value.
I tried to change the order of columns, make a new grid with other data, but always the first header column on mouseover give me error.
PHP Code:
sms.data.smsStore = Ext.extend(Ext.data.Store, {
constructor: function(){
sms.data.smsStore.superclass.constructor.call(this, {
sortInfo: {
field: 'sendDate',
direction: "DESC"
},
reader: new Ext.data.JsonReader({
id: 'smsId',
fields: sms.data.smsRecord
})
});
this.conn = sms.data.conn;
//SQlite nome tabella, nome ID
this.proxy = new Ext.sql.Proxy(sms.data.conn, 'sms', 'smsId', this);
},
addSms: function(phone, message, result){
var id = Ext.uniqueId();
var date = new Date();
l = new sms.data.smsRecord({
smsId: id,
sendDate: date,
phone: phone,
message: message,
result: result
}, id);
this.add(l);
return l;
},
init: function(){
this.load();
}
});
PHP Code:
Ext.uniqueId = function(){
var t = String(new Date().getTime()).substr(4);
var s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for (var i = 0; i < 4; i++) {
t += s.charAt(Math.floor(Math.random() * 26));
}
return t;
}
sms.data.smsRecord = Ext.data.Record.create([
{name: 'smsId', type:'string'},
{name: 'sendDate', type:'date', dateFormat: Ext.sql.Proxy.DATE_FORMAT, defaultValue: ''},
{name: 'phone', type:'string'},
{name: 'message', type:'string'},
{name: 'result', type:'string'}
]);
sms.data.conn = Ext.sql.Connection.getInstance();
sms.data.sms = new sms.data.smsStore();
PHP Code:
var smsGrid = new Ext.grid.GridPanel({
title: 'Registro Sms',
id: 'smsG',
viewConfig: {
forceFit: true
},
store: sms.data.sms,
cm: new Ext.grid.ColumnModel([{
header: 'Codice',
dataIndex: 'smsId',
hidden: true
}, {
header: 'Data',
dataIndex: 'sendDate',
renderer: Ext.util.Format.dateRenderer('m/d/Y H:i'),
sortable: true
}, {
header: 'Cellulare',
dataIndex: 'phone',
sortable: true
}, {
header: 'Messaggio',
dataIndex: 'message',
sortable: true
}, {
header: 'Esito',
dataIndex: 'result',
sortable: true
}]),
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
})
});
Sorry for English.
Thank's in advance.