同一个页面,同一个表格内需要运行两个JS,但是页面只能加载一个JS,求把两个功能的JS合并成一个。
本人小白一枚,求大神帮忙!
- 第一个JS:
- // JavaScript source code
- Forguncy.Page.ready(function () {
- var priceColIndex = 14;
- var countColIndex = 18;
- var isSettingValue = false;
- var listview = Forguncy.Page.getListView("表格1");
- var updateCount = function (row) {
- var price = listview.getValue(row, priceColIndex);
- if (price == "特") {
- var count = 0.1
- }
- if (price == "超") {
- var count = 0.05
- }
- isSettingValue = true;
- listview.setValue(row, countColIndex, count);
- isSettingValue = false;
- return true;
- }
- var updatePrice = function (row) {
- var count = listview.getValue(row, countColIndex);
- if (count <= 0.05) {
- var price = "超"
- }
- if (count > 0.05) {
- var price = "特"
- }
- isSettingValue = true;
- listview.setValue(row, priceColIndex, price);
- isSettingValue = false;
- return true;
- }
- listview.bind(Forguncy.ListViewEvents.ValueChanged, function (arg1, arg2) {
- if (isSettingValue) {
- return;
- }
- var row = arg2.CellRanges[0].Row;
- var col = arg2.CellRanges[0].Column;
- if (row >= 0 && col >= 0) {
- if (col === priceColIndex) {
- updateCount(row);
- }
-
- else if (col === countColIndex) {
- updatePrice(row);
-
- }
-
- }
- });
- });
- 第二个JS:
- var comboboxColIndex = 0;
- var columnName = "3e26be062af82f5cb9b45193efe839d1";
- var columnWidth = 350;
- var spread = Forguncy.Page.getListView("表格1").getControl();
- var sheet = spread.getActiveSheet();
- sheet.bind(GC.Spread.Sheets.Events.EditorStatusChanged, function (eventType, args) {
- var col = sheet.getActiveColumnIndex();
- if (col === comboboxColIndex) {
- var row = sheet.getActiveRowIndex();
- var combobox = sheet.getCellType(row, col).getGcCombobox();
- combobox.getDropDownList().updateColumnWidth(columnName, columnWidth);
- }
- });
复制代码
|