Привет, в настоящее время я использую LocalStorage в своем Sencha Touch + Phonegap в своем приложении и загружаю более 4000+ записей, полученных из WCF Rest. В режиме разработки у меня нет проблем с его запуском в Google Chrome, но когда я упаковал его и установил на устройство iOS8, мое приложение вылетает.
Ниже приведена общая длина localStorage в консоли:
>JSON.stringify(localStorage).length
> 2917665
Модель:
Ext.define("QualityAudit.model.DefectMatrix", {
extend: "Ext.data.Model",
config: {
identifier: { type: 'uuid', isUnique: true },
fields: [
{ name: "DefectMatrixID", type: "integer" },
{ name: "CustomerID", type: "integer" },
{ name: "CustomerName", type: "string" },
{ name: "DefectType", type: "integer" },
{ name: "DefectTypeName", type: "string" },
{ name: "Reference", type: "string" },
{ name: "Section", type: "string" },
{ name: "DefectDescription", type: "string" },
{ name: "SeverityID", type: "integer" },
{ name: "SeverityName", type: "string" },
{ name: "IsActive", type: "bool" },
{ name: "CreatedBy", type: "string" },
{ name: "CreatedDate", type: 'date', dateFormat: 'MS' }
]
}
});
Магазин:
defectSync: function (counter, totRecords, callback) {
var me = this;
if (counter == undefined)
counter = 0;
//load defect matrix local local storage
var defectsLocalStore = Ext.getStore('DefectMatrix');
defectsLocalStore.load();
var defectssurl = window.REST_DMGetListAllPaging + counter;
QualityAudit.util.Proxy.doAjaxCall(defectssurl, '',
function (response) {
var data = Ext.JSON.decode(response.responseText); //encode Json List
defectsLocalStore.load({
callback: function (records, operation, success) {
Ext.Array.each(data, function (record) {
counter++;
record.dirty = true;
defectsLocalStore.add(record);
defectsLocalStore.sync();
});
console.log('DECFECT DATA AFTER SYNC: ' + defectsLocalStore.getData().length);
//Check if all records loaded on local storage is equail to total defect rows then complete
if (defectsLocalStore.getData().length >= totRecords) {
console.log('defect loading successfull');
callback();
} else {
//Trigger again until condition is met
me.defectSync(counter, totRecords, callback);
}
},
scope: this
});
},
function (response) {
defectsLocalStore.load();
callback(0);
});
}
Кто-нибудь пробовал использовать webSQL или SQLlite в ваших проектах? Я не могу найти хороший образец на этом.
Любая помощь и предложения очень ценятся.