• Grid的编辑事件


    <ext:Grid ID="EMCGrid" Title="暗室类测试项目详细配置" ShowBorder="true" ShowHeader="true" DataKeyNames="ObjectAID,ObjectAID"
    AllowCellEditing="true" ClicksToEdit="1"
    runat="server" ForceFit="true" BoxConfigAlign="Stretch" Hidden="true" OnPreRowDataBound="EMCGrid_PreRowDataBound"
    OnRowCommand="EMCGrid_RowCommand">
    <Columns>
    <ext:RenderCheckField DataField="Selected" HeaderText="" Width="50" />
    <ext:RowNumberField EnablePagingNumber="true" Width="50" HeaderText="序号"/>
    <ext:BoundField DataField="TestItem" HeaderText="测试项目" ExpandUnusedSpace="true"/>
    <ext:BoundField DataField="ObjectName" HeaderText="测试频段" ExpandUnusedSpace="true"/>
    <ext:BoundField ColumnID="EMCNumA" DataField="NumA" HeaderText="测试典型值(min)" Width="120" />
    <ext:BoundField ColumnID="EMCNumB" DataField="NumB" HeaderText="组网典型值(min)" Width="120" />
    <ext:RenderField ColumnID="EMCNum1" DataField="Num1" HeaderText="配置数" FieldType="Int" ExpandUnusedSpace="true"
    RendererFunction="renderNum1">
    <Editor>
    <ext:NumberBox runat="server" MinValue="0" Required="true"/>
    </Editor>
    </ext:RenderField>
    <ext:RenderField ColumnID="EMCNum2" DataField="Num2" HeaderText="电压数" FieldType="Int" ExpandUnusedSpace="true">
    <Editor>
    <ext:NumberBox runat="server" MinValue="0"/>
    </Editor>
    </ext:RenderField>
    <ext:BoundField Width="120" ColumnID="EMCNum3" DataField="Num3" HeaderText="测试时长(min)"/>
    <ext:BoundField Width="120" ColumnID="EMCNum4" DataField="Num4" HeaderText="组网时长(min)"/>
    <ext:BoundField Width="120" ColumnID="EMCNum5" DataField="Num5" HeaderText="总时长(min)"/>
    </Columns>
    <Listeners>
    <ext:Listener Event="edit" Handler="onEMCGridAfterEdit"/>
    </Listeners>
    </ext:Grid>

    function renderNum1(value, params) {
    var me = this, columnId = params.column.id, rowIdx = params.rowIdx, colIdx = params.colIdx, rowId = params.record.getId();
    if (params.record.data["EMCTestItem"] == "RE" || params.record.data["EMCTestItem"] == "RS" || params.record.data["EMCTestItem"] == "prestest") {
    if (params.record.data["EMCNum1"] < 1) {
    me.f_updateCellValue(rowId, 'EMCNum1', 1);
    var fEMCNum1 = me.f_getCellValue(rowId, 'EMCNum1');
    var fEMCNum2 = me.f_getCellValue(rowId, 'EMCNum2');
    var fEMCNumA = me.f_getCellValue(rowId, 'EMCNumA');
    var fEMCNumB = me.f_getCellValue(rowId, 'EMCNumB');

    me.f_updateCellValue(rowId, 'EMCNum3', fEMCNumA * fEMCNum1 * fEMCNum2);
    me.f_updateCellValue(rowId, 'EMCNum4', fEMCNumB * fEMCNum1);
    me.f_updateCellValue(rowId, 'EMCNum5', fEMCNumA * fEMCNum1 * fEMCNum2 + fEMCNumB * fEMCNum1);
    value = 1;
    }
    }

    return value;
    }

    <script src="../res/js/jquery.min.js" type="text/javascript"></script>
    <script src="../res/autocomplete/jquery-ui.js" type="text/javascript"></script>
    <script type="text/javascript">

    var EMCgridClientID = '<%= EMCGrid.ClientID %>';

    F.ready(function () {

    var EMCgrid = F(EMCgridClientID);
    onSpecialKey(EMCgrid);

    });

    </script>

    <script src="../js/EditGrid.js" type="text/javascript"></script>
    <script src="../js/ystep.js" type="text/javascript"></script>
    <script type="text/javascript">

      

    // 注意:专业版中改事件名为:afteredit,开源版中为:edit
    function onEMCGridAfterEdit(editor, params) {

    var me = this, columnId = params.column.id, rowIdx = params.rowIdx, colIdx = params.colIdx, rowId = params.record.getId();
    var store = me.getStore();

    Ext.suspendLayouts();
    me.suspendEvents();

    if (columnId === 'EMCNum1' || columnId === 'EMCNum2') {
    var fEMCNum1 = me.f_getCellValue(rowId, 'EMCNum1');
    var fEMCNum2 = me.f_getCellValue(rowId, 'EMCNum2');
    var fEMCNumA = me.f_getCellValue(rowId, 'EMCNumA');
    var fEMCNumB = me.f_getCellValue(rowId, 'EMCNumB');

    me.f_updateCellValue(rowId, 'EMCNum3', fEMCNumA * fEMCNum1 * fEMCNum2);
    me.f_updateCellValue(rowId, 'EMCNum4', fEMCNumB * fEMCNum1);
    me.f_updateCellValue(rowId, 'EMCNum5', fEMCNumA * fEMCNum1 * fEMCNum2 + fEMCNumB * fEMCNum1);
    }

    me.resumeEvents();
    Ext.resumeLayouts(true);

    //说明编辑的行不是最后一行,回车后进入下一行
    if (rowIdx < store.getCount() && editor.lastKey == 13) {
    var NextRowId = parseInt(rowIdx) + 1;
    me.f_cellEditing.startEdit(NextRowId, 1);

    }
    editor.lastKey = 0;

    }

    </script>

  • 相关阅读:
    使用SO_REVTIMEO套接字选项为recvfrom设置超时
    使用select为描述符设置超时
    套接字超时设置方法
    使用SIGALARM为recvfrom设置超时
    使用SIGALARM为connect设置超时
    20200410 阿里巴巴Java开发手册
    20200409 Vue 视频学习【归档】
    20200319 Spring MVC 官方文档【归档】
    20200319 Spring Web MVC 2-5
    20200319 Spring Web MVC 1
  • 原文地址:https://www.cnblogs.com/sanshengshitouhua/p/14428191.html
Copyright © 2020-2023  润新知