|
53 | 53 | this.root = 'fjs'; |
54 | 54 | } |
55 | 55 |
|
| 56 | + this.id_field = this.options.id_field || 'id'; |
56 | 57 | this.render(this.data); |
57 | 58 | this.parseOptions(); |
58 | 59 | this.buildCategoryMap(this.data); |
|
87 | 88 | for (var i = 0, l = data.length; i < l; i++){ |
88 | 89 | record = this.getRecord(i, data); |
89 | 90 | el = $(this.view(record)); |
90 | | - el.attr({id: this.root + '_' + record.id, 'data-fjs': true}); |
| 91 | + el.attr({id: this.root + '_' + record[this.id_field], 'data-fjs': true}); |
91 | 92 | el = $container.append(el); |
92 | 93 | } |
93 | 94 | }, |
|
256 | 257 |
|
257 | 258 | for (var i = 0, l = data.length; i < l; i++){ |
258 | 259 | record = this.getRecord(i, data); |
259 | | - this.record_ids.push(record.id); |
| 260 | + this.record_ids.push(record[this.id_field]); |
260 | 261 |
|
261 | 262 | for (name in filter_criteria) { |
262 | 263 | categories = eval('record.' + filter_criteria[name][2]); |
|
265 | 266 | if (categories && categories.constructor == Array) { |
266 | 267 | for (var j = 0, lj = categories.length; j < lj; j++){ |
267 | 268 | x = categories[j]; |
268 | | - obj[x] ? obj[x].push(record.id) : obj[x] = [record.id]; |
| 269 | + obj[x] ? obj[x].push(record[this.id_field]) : obj[x] = [record[this.id_field]]; |
269 | 270 | } |
270 | 271 | } else { |
271 | | - obj[categories] ? obj[categories].push(record.id) : obj[categories] = [record.id]; |
| 272 | + obj[categories] ? obj[categories].push(record[this.id_field]) : obj[categories] = [record[this.id_field]]; |
272 | 273 | } |
273 | 274 | } |
274 | 275 | } |
|
325 | 326 |
|
326 | 327 | for (i; i < l; i++){ |
327 | 328 | r = this.getRecord(i, this.data); |
328 | | - if (ids.indexOf(r.id) != -1) records.push(r) |
| 329 | + if (ids.indexOf(r[this.id_field]) != -1) records.push(r) |
329 | 330 | } |
330 | 331 |
|
331 | 332 | return records; |
|
0 commit comments