var pmStore = new storeOfUsers(); // storeOfUsers is an Ext.data.DirectStore with autoLoad: true
console.log(pmStore.data); // is an Ext.util.MixedCollection with 6 items including user_id == 1
var pms = pmStore.data.filter('user_id', 1);
console.log(pms); //is an Ext.util.MixedCollection with length == 0
안녕하세요.
MixedCollection을 필터링 한 후 user_id == 1 인 결과가 있지만 반환 된 컬렉션은 비어 있습니다. 내가 놓친 것이 있습니까?
감사합니다.ExtJs4 혼합 콜렉션 필터링
제 생각에 문제는 저장소의 비동기 로딩입니다. 당신은 아마도 그것이 loded되기 전에 가게를 필터링하고 있습니다. 나는 과거에'console.log()'가 동기 데이터를 보여주는 인스턴스를 가지고 있었다. 마치 호출이 완료되면 로그가 갱신되는 것처럼 보인다. 자동로드를 취소하고 데이터를 필터링하는 콜백 대신 수동로드를 수행하려고합니다. – Izhaki
console.log (pmStore.data); // 길이가 6 인 객체를 보여줍니다. console.log (pmStore.data.length); // shows 0 아이 자키, 당신 말이 맞아요. 'console.log'는 현재의 오브젝트 상태를 나타내며 'console.log'가 호출 된 상태는 표시하지 않습니다. 방금 필터링하지 않으려 고했습니다. 감사! – SergB