GridTable.js
1.5 KB
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
define(["utils"], function (_u) {
    'use strict';
    function GridTable() {
        this.store = {};
    }
    GridTable.prototype = {
        transferToVM: function (dm) {
            var btns = dm.btn_datas;
            var gtHeight = "height:auto;";
            var autoHeight = true;
            var fixedColumn = 0;
            var cols = dm.gw_datas.map(function (d, i) {
                return {
                    text: d.columnText,
                    width: d.columnWidth && _u.toPixel(d.columnWidth, "width"),
                    fixedColumn: i < fixedColumn
                };
            });
            if(dm.gtHeight) {
                gtHeight = _u.toPixel(dm.gtHeight, "height");
                autoHeight = false;
            }
            return {
            	normalSearch: {
            		hide: dm.hiddenSearch == 1,
            		tip: dm.searchTips
            	},
            	advancedSearch: {
            		enable: dm.advancedSearch == 1,
            		title: dm.asBigTitle || "高级检索"
            	},
                btns: btns.map(function (btn) {
                    return { text: btn.btnText };
                }),
                options: {
                	width: _u.toPixel(dm.gtWidth || "100%", "width"),
                	height: gtHeight,
                	autoHeight: autoHeight,
                },
                headerView: {
                	normal: cols,
                	fixed: cols.slice(0, fixedColumn)
                }
            }
        }
    };
    return GridTable;
});