2012-07-23 3 views
1

POST/만들기 동작을 호출하는 나머지 프록시에서 레코드를 성공적으로 유지 한 후 이후의 저장시 동일한 POST/Create 메서드를 호출하고 PUT/업데이트 하나?EXTJS 4 모델이 업데이트 대신 지속 된 레코드를 만들려고합니다.

POSTS 또한

var ref = beginQuestionnaireControl.getPegfileRef(); 
var Pegfile = Ext.create('Pegfect.model.Pegfile', { 
    Id: 0, 
    Reference: ref 
}); 
Pegfile.save({ 
    scope: this, 
    success: function (pegfile, operation) { 
    this.activePegfile = pegfile; 
    this.startQuestions(); 
    }, 
    failure: function() { 
    alert('That ref is not unique'); 
    } 
}); 

게시물 (예상해 PUT)

this.activePegfile.save({ 
     success: function() { 
     successCallback(); 
     }, 
     failure: function() { 
     alert('oops, error saving Pegfile'); 
     } 
    }); 

프록시 트릭이 정의하는

proxy: 
    { 
    type: 'rest', 
    url: 'Pegfile', 
    timeout: 120000, 
    noCache: false, 

    reader: 
    { 
     type: 'json', 
     root: 'data', 
     successProperty: 'success' 
    }, 

    writer: 
    { 
     type: 'json', 
     writeAllFields: true 
    } 
    } 

답변

0

n은 모델에 'Id'속성이 하나의 설정을 통해 일부 대회 외치다

idProperty: 'Id' 

은 ...

+1

기본값은 "아이디"하지만, 대소 문자를 구분합니다 –