jxdnsong
2020-10-23 a7929e6b3ec9ac17233f39e55a2b8ac63ea75f42
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
define([
    'dojo/_base/lang',
    './createSyncStore'
], function (lang, createSyncStore) {
    return function createOrderedStore(kwArgs) {
        // dstore already supports ordering w/ beforeId,
        // but add a copy method to test optional feature supported by DnD
        return createSyncStore(lang.mixin({
            copy: function (object, options) {
                // summary:
                //        Given an item already in the store, creates a copy of it.
                //        (i.e., shallow-clones the item sans id, then calls add)
 
                var newObj = lang.mixin({}, object);
                // Ensure unique ID by removing it from the cloned item
                newObj[this.idProperty] = null;
                return this.add(newObj, options);
            }
        }, kwArgs));
    };
});