2010-06-27 15 views

답변

1

나는 데이터를 통해 레코드를 의미한다고 가정합니다. 이 경우 MyApp.store의 'commitRecordsAutomatically'속성을 True로 설정할 수 있습니다.

페이지를 떠나는 사용자를 감지 할 수 있으면 MyApp.store.commitRecords()를 호출 할 수 있습니다.

3

Sproutcore가 보증하는 구체적인 방법은 없습니다.

core.js에서 그것이 당신 또는 누군가를하는 데 도움이

main.js
window.onbeforeunload = function(){ 
    var dirty = MyApp.storeIsDirty(), 
    busy = MyApp.storeIsBusy(); 

    if (dirty || busy) { 
    // User will be prompted with the return value 
    return 'You have unsaved changes and will lose them if you continue.'; 
    } 
} 

나는 그 연체 알고,하지만 난 희망에 그런
MyApp = SC.Object.create({ 

    // ... 

    storeIsDirty: function(){ 
    var statuses = this.store.statuses, storeKey; 
    for(storeKey in statuses){ 
     if (statuses[storeKey] & SC.Record.DIRTY) return YES; 
    } 
    return NO; 
    }, 

    storeIsBusy: function(){ 
    var statuses = this.store.statuses, storeKey; 
    for(storeKey in statuses){ 
     if (statuses[storeKey] & SC.Record.BUSY) return YES; 
    } 
    return NO; 
    } 

}); 

: 그러나 나는이 같은 약 보이는 뭔가를했다 그밖에.

기타 문의 사항은 #sproutcore의 IRC 대화방을 방문하거나 [email protected]에서 메일 링리스트를 확인하십시오.

관련 문제