我正在extjs4 MVC結構工作,我一直在extjs4 所有的領域提交到服務器端的問題,但我只想發送模型類的一些文件到服務器端。我怎樣才能得到這個輸出?如何在extjs4中將模型特定屬性發送到服務器端?
1)這是我的模型類
Ext.define('ab.model.sn.UserModel',{
extend: 'Ext.data.Model',
//idproperty:'userId',//fields property first position pk.
fields: ['userId','firstName','middleName','lastName','languageId','primaryEmail','birthDate','password','securityQuestionId','securityQuestionAnswer','isMale','creationTime','ipAddress','confirmationCode','userStatusId',],
proxy:
{
type:'ajax',
//type:'localstorage',
//id:'users',
api:
{
read:'http://localhost/balaee/Balaee/index.php/SocialNetworking/user/AuthenticateLogin',
create:'http://localhost/balaee/Balaee/index.php/SocialNetworking/user/AuthenticateLogin122',
update:'http://localhost/balaee/Balaee/index.php/SocialNetworking/user/AuthenticateLogin123'
},//end of api
reader:
{
type:'json',
},//end of reader
writer:
{
type:'json',
root:'records',
},//End of writer
}//end of proxy
});
2)這是我的一些控制文件中的代碼
var userObject = Ext.ModelManager.create(
{
firstName:record.get('firstName'),
password:record.get('password'),
},'ab.model.sn.UserModel');
userObject.save({
success: function(record, operation)
{
console.log("registration successssssssssss "+record.get('userId'));
},//End of success function
failure: function(record, operation)
{
console.log("Inside failure functionnnnn");
},//End of failure function
callback: function(record, operation)
{
console.log("Inside callback functionnnnnn");
}//End of callback function
});// End of check save function
3)和數據會以JSON格式去
{"records":{"userId":"","firstName":"ram","middleName":"","lastName":"","languageId":"","primaryEmail":"","birthDate":"","password":"sham","securityQuestionId":"","securityQuestionAnswer":"","isMale":"","creationTime":"","ipAddress":"","confirmationCode":"","userStatusId":"","id":null}}
4)但我想只發送名字和密碼。我不想發送所有的字段。我怎樣才能將數據發送到服務器端。
我想以JSON格式
{"records":{"firstName":"ram","password":"sham"}}
,請給我一些建議....
非常感謝。它解決了。 – 2013-02-25 13:54:28
+1簡明 – Geronimo 2013-02-25 18:10:54