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
define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/dom-class',
    'dijit/_WidgetBase',
    './ColumnConfigForm',
    './ColumnGrid'
], function (declare, lang, domClass, _WidgetBase, ColumnConfigForm, ColumnGrid) {
    return declare(_WidgetBase, {
        baseClass: 'columnEditor',
 
        buildRendering: function () {
            this.inherited(arguments);
 
            this.columnGrid = new ColumnGrid().placeAt(this.domNode);
            this.form = new ColumnConfigForm().placeAt(this.domNode);
        },
 
        postCreate: function () {
            this.inherited(arguments);
 
            this.form.on('close', lang.hitch(this, '_showGrid'));
            this.columnGrid.on('editcolumn', lang.hitch(this, '_onEditColumn'));
        },
 
        startup: function () {
            if (this._started) {
                return;
            }
            this.inherited(arguments);
 
            this.columnGrid.startup();
            this.form.startup();
        },
 
        _getColumnsAttr: function () {
            return this.columnGrid.get('columns');
        },
 
        _showGrid: function () {
            domClass.remove(this.domNode, 'slid');
        },
 
        _onEditColumn: function (event) {
            domClass.add(this.domNode, 'slid');
            this.form.set('value', event.data);
        },
 
        addColumn: function (label) {
            this.columnGrid.addColumn(label);
        },
 
        removeColumn: function (target) {
            this.columnGrid.removeColumn(target);
        }
    });
});