123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- /**
- * Created by CSL on 2017-03-23.
- */
- function loadLibFiles(region) {
- $('#inlineFormCustomSelect').empty();
- $.ajax({
- type: "POST",
- url: '/fees/getLibFiles',
- data: {"region": region},
- success: function (result) {
- if (result.data) {
- for (var i = 0; i < result.data.length; i++) {
- $("#inlineFormCustomSelect").append("<option value=" + result.data[i].fileID + '>' +
- result.data[i].fileName + "</option>");
- }
- $("#inlineFormCustomSelect").get(0).selectedIndex = 0;
- var fileID = $("#inlineFormCustomSelect").val();
- loadLibFees(fileID);
- }
- },
- error: function (result) {
- alert('内部程序错误!');
- }
- });
- }
- function loadLibFees(fileID) {
- $.ajax({
- type: "POST",
- url: '/fees/getLibFees',
- data: {"fileID": fileID},
- success: function (result) {
- if (result.data) {
- createSpreadView(result.data[0].fees);
- }
- },
- error: function (result) {
- alert('内部程序错误!');
- }
- });
- }
- function createSpreadView(data) {
- // 创建前先销毁旧树表。
- //$('#divFee').empty(); // 清空不行,浏览器跟踪显示错误数狂飚:TypeError: G is null
- $('#divFee').remove();
- $('#content').append($('<div class="grid" id="divFee"></div>'));
- var columns = [
- {
- id: 'name',
- caption: '名称',
- dataField: 'name',
- width: 250
- },
- {
- id: 'fee',
- caption: '费率',
- dataField: 'fee',
- format: '0.000',
- width: 80,
- minWidth: 50
- },
- {
- id: 'memo',
- caption: '说明',
- dataField: 'memo',
- width: 200,
- minWidth: 120
- },
- {
- id: 'ID',
- caption: 'ID',
- dataField: 'ID',
- width: 80,
- visible: false
- },
- {
- id: 'ParentID',
- caption: '父结点ID',
- dataField: 'ParentID',
- width: 80,
- visible: false
- }
- ];
- var option = {
- allowSorting: false,
- showRowHeader: true,
- colMinWidth: 80,
- colHeaderHeight: 35,
- rowHeight: 30,
- allowEditing: true,
- hierarchy: {
- keyField: 'ID',
- parentField: 'ParentID',
- collapsed: false,
- column: 'name'
- }
- };
- var dataView = new GC.Spread.Views.DataView(document.getElementById('divFee'),
- data, columns, new GC.Spread.Views.Plugins.GridLayout(option));
- var opts = dataView.layoutEngine.options;
- opts.editMode = 'inline';
- opts.editUnit = 'cell';
- opts.selectionUnit = 'cell';
- dataView.invalidate();
- document.querySelector('#divFee').focus();
- }
|