• datagrid columns


    columns: [[
    { field: 'Source_Id', title: 'Source_Id', hidden: true },
    //{ field: 'Current_Value', hidden: true },
    { field: 'Source_Type_Id', title: 'Source_Type_Id', hidden: true },
    {
    //field: 'Object_Name', title: SIMS_lang.ColumnsField.Signal, 300, editor: {
    field: 'Object_Id', title: SIMS_lang.ColumnsField.Signal, 300, editor: {
    //field: 'station_type_name', title: SIMS_lang.ColumnsField.Signal, 300, editor: {
    type: 'combotree',
    options: {
    data: treeData,
    onBeforeSelect: function (node) {
    var ed = $("#divELlink" + pNo).datagrid('getEditors', clickIndex);
    if (node.attributes.Object_Type_Id == 3) {
    $.messager.show({
    title: SIMS_lang.DialogTitle.Prompt,
    msg: SIMS_lang.MessageStr.PleaseSelectMeasure,
    timeout: 3000,
    showType: 'slide'
    });
    if (ed && ed.length != 0) {
    $(ed[1].target).combobox('disable');
    $(ed[2].target).combobox('disable');
    }
    return false;
    }
    return true;
    },
    onSelect: function (node) {
    comData = "";
    var ed = $("#divELlink" + pNo).datagrid('getEditors', clickIndex);
    if (node.attributes.Object_Type_Id == 3) {
    $.messager.show({
    title: SIMS_lang.DialogTitle.Prompt,
    msg: SIMS_lang.MessageStr.PleaseSelectMeasure,
    timeout: 3000,
    showType: 'slide'
    });
    if (ed && ed.length != 0) {
    $(ed[1].target).combobox('disable');
    $(ed[2].target).combobox('disable');
    }
    return;
    }
    else {
    if (ed && ed.length != 0) {
    $(ed[1].target).combobox('enable');
    $(ed[2].target).combobox('enable');
    }
    }
    if (node.attributes.Object_Type_Id == 4) {
    $.ajax({
    type: "post",
    url: "/RealTimeMonitor/GetEventLinkage",
    data: { objectid: node.id, queryType: 5 },
    success: function (data) {
    $(ed[1].target).combobox({
    valueField: 'id',
    textField: 'name',
    data: data,
    onLoadSuccess: function () {
    if (tempSourceValue != null) {
    $(ed[1].target).combobox('select', tempSourceValue);
    tempSourceValue = null;
    }
    else {
    if (data.length > 0) {
    $(ed[1].target).combobox('select', data[0].id);
    }
    }
    }
    });
    comData = data;
    }
    });
    $(ed[2].target).combobox({
    valueField: 'id',
    textField: 'name',
    data: [{ id: '0', name: '0' }]
    });
    $(ed[2].target).combobox('select', 0);
    $(ed[2].target).combobox('disable');
    }
    else {
    $(ed[1].target).combobox('clear');
    $(ed[1].target).combobox({
    valueField: 'id',
    textField: 'name',
    data: [{ id: '', name: '' }]
    });
    $(ed[2].target).combobox('enable');
    }
    var nn = $(ed[0].target).combotree('tree').tree('getSelected');
    if (nn) {
    $(ed[0].target).combotree('tree').tree('expandTo', nn.target);
    }
    }
    }
    },
    formatter: function (value, row, index) {
    if (value != "") {
    for (var i = 0; i < treeData.length; i++) {
    if (value == treeData[i].id) {
    row.Source_Id = value;
    row.Source_Type_Id = treeData[i].attributes.Object_Type_Id;
    return treeData[i].text;
    }
    var child = treeData[i].children;
    for (var j = 0; j < child.length; j++) {
    if (value == child[j].id) {
    row.Source_Id = value;
    row.Source_Type_Id = child[j].attributes.Object_Type_Id;
    return child[j].text;
    }
    }
    }
    }
    return value;
    }
    },
    { field: 'Source_Value_Low', title: SIMS_lang.ColumnsField.ContorlValue, hidden: true },
    {
    //field: 'Source_Value_Low', title: SIMS_lang.ColumnsField.ValueLowLimit, 200, editor: { type: 'combobox', options: { 200 } },
    field: 'Contrl_means', title: SIMS_lang.ColumnsField.ValueLowLimit, 200, editor: {
    type: 'combobox', options: {
    200
    }
    },
    formatter: function (value, row, index) {
    if (comData != "" && comData.length != 0) {
    for (var i = 0; i < comData.length; i++) {
    //if (value == comData[i].State_Value) {
    // row.Source_Value_Low = value;
    // return comData[i].State_Means;
    //}
    if (value == comData[i].id) {
    row.Source_Value_Low = value;
    return comData[i].name;
    }
    }
    } else {
    //if (value.length>0) {
    // var alarmValue = parseInt(row.Current_Value).toString();
    // var s = value.replace(/{/g, '').replace(/}/g, '').replace(/"/g, '');
    // arrayObj = new Array();
    // arrayObj2 = new Array();
    // arrayObj = s.split(',');
    // for (var i = 0; i < arrayObj.length; i++) {
    // arrayObj2 = arrayObj[i].split(':');
    // if (arrayObj2[0] == alarmValue) {
    // return arrayObj2[1];
    // }
    // }
    //}
    //else {
    return value;
    //}
    }
    }
    },
    {
    field: 'Source_Value_High', title: SIMS_lang.ColumnsField.ValueHighLimit, 200, editor: { type: 'combobox', options: { 200 } }
    }
    ]]

  • 相关阅读:
    一款好用的绘图软件gnuplot
    剑指offer--18.从尾到头打印链表
    剑指offer--17.第一个只出现一次的字符
    剑指offer--16.数组中重复的数字
    剑指offer--15.把字符串转换成整数
    剑指offer--14.求1+2+3+...+n
    剑指offer--13.二进制中1的个数
    剑指offer--12.不用加减乘除做加法
    剑指offer--11.数组中出现次数超过一半的数字
    剑指offer--10.最小的K个数
  • 原文地址:https://www.cnblogs.com/huangf714/p/5907987.html
Copyright © 2020-2023  润新知