Browse Source

Added possibility to rename fields on a DataSet.get()

Added functionality to extend the fields array, to a fields object,
similar to the type declaration. This makes it possible rename
properies when you get them.
v3_develop
Måns Beckman 9 years ago
parent
commit
eb5afcfc6a
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      lib/DataSet.js

+ 8
- 2
lib/DataSet.js View File

@ -664,8 +664,14 @@ DataSet.prototype._filterFields = function (item, fields) {
var filteredItem = {};
for (var field in item) {
if (item.hasOwnProperty(field) && (fields.indexOf(field) != -1)) {
filteredItem[field] = item[field];
if(Array.isArray(fields)){
if (item.hasOwnProperty(field) && (fields.indexOf(field) != -1)) {
filteredItem[field] = item[field];
}
}else{
if (item.hasOwnProperty(field) && fields.hasOwnProperty(field)) {
filteredItem[fields[field]] = item[field];
}
}
}

Loading…
Cancel
Save