0
我正試圖處理數據到服務器的傳輸。如何在點擊時運行事件加載?
我的問題:
Ext.onReady(function(){
Ext.define('Person', {
extend: 'Ext.data.Model',
idProperty: 'PersonID',
fields: [{
name: 'PersonID',
type: 'int'
}, .......],
proxy: {
type: 'ajax',
api: {
read: '1.php?id=90',
create: 'create.php',
update: 'upd.php',
destroy: 'delete.php'
}
}
});
Person.load(1, {
//callback который будет выполнен когда запрос пройдет....
callback: function(p, operation){
//p -это текущий объект
alert(p.get('Name'))
console.log(p.get('PersonID')); //1
console.log(p.get('Salary')) //300
//document.getElementsByTagName('p')[0].innerHTML='<input type="button" value="click" onclick="function(){p.load()}">'
//Uncaught ReferenceError: p is not defined ?
//Uncaught SyntaxError: Unexpected token (
}
});
person=new Person;
上面的代碼工作。 如何通過點擊按鈕來運行事件load()
? 我希望你能幫我解決 謝謝。
完美。謝謝 –