안녕하세요. 데이터 저장소를 다른 곳으로 복사하는 방법을 알려주십시오. 다음과 같은 방법으로 시도했지만 작동하지 않습니다. 여기에 jsonStore에서 newGridStore로 데이터를 복사하려고합니다.dojo 데이터 저장소 복제/복사
jsonStore.fetch({query:{} , onComplete: onComplete});
var onComplete = function (items, request) {
newGridStore = null;
newGridStore = new dojo.data.ItemFileWriteStore({
data : {}
});
if (items && items.length > 0) {
var i;
for (i = 0; i < items.length; i++) {
var item = items[i];
var attributes = jsonStore.getAttributes(item);
if (attributes && attributes.length > 0) {
var j;
for (j = 0; j < attributes.length; j++) {
var newItem = {};
var values = jsonStore.getValues(item, attributes[j]);
if (values) {
if (values.length > 1) {
// Create a copy.
newItem[attributes[j]] = values.slice(0, values.length);
} else {
newItem[attributes[j]] = values[0];
}
}
}
newGridStore.newItem(newItem);
}
}
}
}
그렇게하기 전에 보여줍니다. 왜 이렇게하려고하는지 설명 할 수 있습니까? – Layke
Becouse jsonStore를 새 값으로 업데이트 한 후 이전 값을 가진 값과 비교해야합니다. – nath
그러면 잘못하고 있습니다. 내 대답을 보라. – Layke