我正在使用 lokijs 来存储一些我需要使用的数据。我的数据如下所示。作为 lokijs 的新手,我一直在努力寻找一种方法来item_part_option_groups
摆脱part
.
我的代码
partDb = new loki('part.json');
partData = partDb.addCollection('part');
$.get(urlHelper.createUrl('item/parts', 'part', config.partId + '.json'), function(data){
partData.insert(data);
var data = partData.find({'part':'item_part_option_groups'});
console.log(data);
});
数据
{
"part": {
"item_part_id": 10,
"name": "Sleeve",
"has_validation": 0,
"description": "",
"is_disabled": "1",
"created": "2015-07-22T23:55:09+0000",
"updated": null,
"item_part_option_groups": [{
"item_part_option_group_id": 10,
"order_index": 0,
"description": "",
"item_part_id": 10,
"created": "2015-07-22T23:55:39+0000",
"updated": null,
"item_part_options": [{
"item_part_option_id": 8,
"name": "Sleeve Type",
"is_conform_value": 0,
"has_validation": 1,
"item_part_option_type_id": 3,
"created": "2015-07-22T23:57:24+0000",
"updated": null,
"item_part_option_values": [{
"value": "Short Sleeve",
"order_index": 0,
"item_part_option_id": 8,
"item_part_option_value_id": 7,
"item_part_option_includes": [
]
}, {
"value": "Long Sleeve",
"order_index": 0,
"item_part_option_id": 8,
"item_part_option_value_id": 8,
"item_part_option_includes": [
]
}, ]
}]
}]
}
}