在我的应用程序中,我想将我的模型转换为 json,然后将此 json 发送到 server.for 适配器,我使用LSA。
例如,我有这样的模型:
App.AxisModel = DS.Model.extend({
uniqueName: DS.attr('string'),
name: DS.attr('string'),
hierarchyUniqueName: DS.attr('string'),
type: DS.attr('string'), //row,column,filter
isMeasure: DS.attr('boolean'),
isActive: DS.attr('boolean'), //is added to one of type
orderId: DS.attr('number'),
isAll:DS.attr('boolean'),
sort:DS.attr('string'),
});
还有一个 json 示例:
{
"OlapApp.AxisModel": {
"records": {
"htlbv": {
"id": "htlbv",
"uniqueName": "[Customers].[(All)]",
"name": "(All)",
"hierarchyUniqueName": "[Customers]",
"type": "column",
"isMeasure": false,
"isActive": true,
"orderId": 0,
"isAll": true,
"sort": "none"
},
"t58i9": {
"id": "t58i9",
"uniqueName": "[Sellers].[(All)]",
"name": "(All)",
"hierarchyUniqueName": "[Sellers]",
"type": "row",
"isMeasure": false,
"isActive": true,
"orderId": 0,
"isAll": true,
"sort": "none"
},
"2t9lc": {
"id": "2t9lc",
"uniqueName": "[Cube1].[Cube1-1]",
"name": "Cube1-1",
"hierarchyUniqueName": "[Database].[Cube1]",
"type": "filter",
"isMeasure": true,
"isActive": true,
"orderId": 0,
"isAll": false,
"sort": "none"
}
}
}
}