nnnjjj123
2020-11-17 1b2c1edb61190eeb19f465ff031eaa3b2a1b8dbc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/dom-construct',
    'dojo/topic',
    'dojo/store/Memory',
    './ConfigForm',
    'dojo/text!./templates/Tree.html',
    'dgrid/Tree',
    // for template
    'dijit/form/FilteringSelect',
    'dijit/form/RadioButton'
], function (declare, lang, domConstruct, topic, Memory, ConfigForm, template, Tree) {
    return declare(ConfigForm, {
        templateString: template,
        defaultsObject: Tree.prototype,
 
        postCreate: function () {
            this.inherited(arguments);
 
            this.own(
                topic.subscribe('/store/columns/update', lang.hitch(this, '_updateColumnNames'))
            );
        },
 
        _updateColumnNames: function (columnStore) {
            var self = this;
            var data = [];
            var firstValue;
 
            columnStore.fetch().forEach(function (column) {
                if (!firstValue) {
                    firstValue = column.field;
                }
                data.push({
                    id: column.field,
                    name: column.field
                });
            }).then(function () {
                self.expandoSelect.set('store', new Memory({ data: data }));
                // Select the first column by default
                // (in case the user selects tree without first visiting the options)
                self.expandoSelect.set('value', firstValue);
            });
        },
 
        _getValueAttr: function () {
            var returnValue = this.inherited(arguments);
 
            // The renderExpando property needs to be specified on the column definition
            // (it's not a grid config property)
            delete returnValue.renderExpando;
 
            return returnValue;
        },
 
        _getExpandoColumnAttr: function () {
            return this.expandoSelect.get('value');
        }
    });
});