Extjs editor plugins

 function AddBatchIssued_Click(fileGrid, rowIndex, colIndex) {
            var record = fileGrid.getStore().getAt(rowIndex); //Get the Record
            var MerBatchId = record.get("MERBATCHID");
            var Employee = Ext.data.Record.create([
                                 { name: 'ISSBANK', type: 'string' },
                                 { name: 'ISSBRANCHBANK', type: 'string' },
                                 { name: 'CARDNUM', type: 'string' },
                                 { name: 'CARDHOLDER', type: 'string' },
                                 { name: 'AMOUNT', type: "float" },
                                 { name: 'MERDETAILREFNUM', type: 'string' },
                                 { name: 'MERREMARK', type: 'string' }
                          ]);
            var da = [];
            var store = new Ext.data.GroupingStore({
                reader: new Ext.data.JsonReader({ fields: Employee }),
                data: da
            });

            var editor = new Ext.ux.grid.RowEditor({
                saveText: 'Update'
            });
            var cmm = [
            new Ext.grid.RowNumberer(),
            { header: '<% = GetLocalResourceObject("IssbankText") %>', dataIndex: "ISSBANK", sortable: true, width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("IssubbakText") %>', dataIndex: "ISSBRANCHBANK", width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("AccountText") %>', dataIndex: "CARDNUM", width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("IssNameText") %>', dataIndex: "CARDHOLDER", width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("MoneyText") %>', xtype: 'numbercolumn', dataIndex: "AMOUNT", format: '0,0.00', width: 100, editor: { xtype: 'numberfield', allowBlank: false, regex: /^\S+$/, minValue: 0.1, maxValue: 150000} },
            { header: '<% = GetLocalResourceObject("MerBatRefnumText") %>', dataIndex: "MERDETAILREFNUM", width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("MemoText") %>', dataIndex: "MERREMARK", width: 100, editor: { xtype: 'textfield'} }
         ];

            var grid = new Ext.grid.GridPanel({
                store: store,
                width: 700,
                height: 400,
                iframe: true,
                region: 'center',
                margins: '0 5 5 5',
                //                autoExpandColumn: 'name',
                plugins: [editor],
                view: new Ext.grid.GroupingView({
                    markDirty: false
                }),
                tbar: [{
                    iconCls: 'icon-user-add',
                    text: '<% = GetLocalResourceObject("AddRowText") %>',
                    handler: function () {
                        var e = new Employee({
                            ISSBANK: "",
                            ISSBRANCHBANK: "",
                            CARDNUM: "",
                            CARDHOLDER: "",
                            AMOUNT: 0.00,
                            MERDETAILREFNUM: "",
                            MERREMARK: ""
                        });
                        editor.stopEditing();
                        store.insert(0, e);
                        grid.getView().refresh();
                        grid.getSelectionModel().selectRow(0);
                        editor.startEditing(0);
                    }
                }, {
                    ref: '../removeBtn',
                    iconCls: 'icon-user-delete',
                    text: '<% = GetLocalResourceObject("DelRowText") %>',
                    disabled: true,
                    handler: function () {
                        editor.stopEditing();
                        var s = grid.getSelectionModel().getSelections();
                        for (var i = 0, r; r = s[i]; i++) {
                            store.remove(r);
                        }
                    }
                }],
                columns: cmm
            });
            grid.getSelectionModel().on('selectionchange', function (sm) {
                grid.removeBtn.setDisabled(sm.getCount() < 1);
            });
            var win = new Ext.Window({
                layout: 'form',
                width: 700,
                resizable: false,
                items: [{ items: [grid]}],
                buttonAlign: "center",
                buttons: [{ text: '<% = GetLocalResourceObject("SaveText") %>', width: '100',
                    handler: function () {
                        if (store.getCount() == 0) {
                            Ext.Msg.alert('<% = GetLocalResourceObject("PromptText") %>', '<% = GetLocalResourceObject("WriteRecordText") %>'); return false;
                        }
                        var array = new Array();
                        store.each(function (r) {
                            array.push(r.data);
                        });
                        var enable = true;
                        for (var i = 0; i < array.length; i++) {
                            var arr = array[i];
                            if (arr.ISSBANK == "" || arr.ISSBRANCHBANK == "" || arr.CARDNUM == "" || arr.CARDHOLDER == "" || arr.AMOUNT < 0.1 || arr.MERDETAILREFNUM == "") {
                                enable = false;
                            }
                        }
                        if (!enable) {
                            Ext.Msg.alert('<% = GetLocalResourceObject("PromptText") %>', '<% = GetLocalResourceObject("WriteFullDataText") %>'); return false;
                        }
                        Ext.Ajax.request({
                            url: "../Handler/Issued.ashx",
                            params: {
                                method: "AddIssuedInfo",
                                MerBatchId: MerBatchId,
                                dataStore: Ext.util.JSON.encode(array)
                            },
                            success: function (response, option) {
                                var result = Ext.util.JSON.decode(response.responseText);
                                if (result.Flag == true) {
                                    Ext.Msg.alert("Success", '<% = GetLocalResourceObject("AddRowSuccessText") %>');
                                    MerBatchStore.load();
                                    store.removeAll();
                                    win.hide();
                                } else {
                                    Ext.Msg.alert("Fail", result.RespMessage);
                                }
                            },
                            failure: function (response, option) {
                                Ext.Msg.alert("Failed", result.RespMessage);
                            }
                        });

                    }
                }]
            });
            win.show(Ext.getBody());
        }

一个页面所有代码

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Default.Master" AutoEventWireup="true"
    CodeBehind="BatchIssued.aspx.cs" Inherits="GlbPay.Web.Merchant.Issued.BatchIssued" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headCSS" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="headScript" runat="server">
<script type="text/javascript" src="../Resource/Script/gen-names.js"></script>
<script type="text/javascript" src="../Resource/Script/RowEditor.js"></script>
  <link rel="stylesheet" type="text/css" href="../Resource/Css/RowEditor.css"/>
  <style type="text/css">
        .x-grid3 .x-window-ml{
            padding-left: 0;    
        } 
        .x-grid3 .x-window-mr {
            padding-right: 0;
        } 
        .x-grid3 .x-window-tl {
            padding-left: 0;
        } 
        .x-grid3 .x-window-tr {
            padding-right: 0;
        } 
        .x-grid3 .x-window-tc .x-window-header {
            height: 3px;
            padding:0;
            overflow:hidden;
        } 
        .x-grid3 .x-window-mc {
            border-width: 0;
            background: #cdd9e8;
        } 
        .x-grid3 .x-window-bl {
            padding-left: 0;
        } 
        .x-grid3 .x-window-br {
            padding-right: 0;
        }
        .x-grid3 .x-panel-btns {
            padding:0;
        }
        .x-grid3 .x-panel-btns td.x-toolbar-cell {
            padding:3px 3px 0;
        }
        .x-box-inner {
            zoom:1;
        }
        .icon-user-add {
            background-image: url(../shared/icons/fam/user_add.gif) !important;
        }
        .icon-user-delete {
            background-image: url(../shared/icons/fam/user_delete.gif) !important;
        }        
    </style>
    <script type="text/javascript">
     var m_pageSize = <%=base.strPageSize %>;
     var m_PageWidth = <%= base.strPageWidth %>;
     var m_MerchantID ="<%=m_MerchantID %>";
    </script>
    <script type="text/javascript">

        function ConvertMerApproveStatus(v) {
            if (v == 0) {
                return '<% = GetLocalResourceObject("NoApproveText") %>';
            }
            else if (v == 1) {
                return '<% = GetLocalResourceObject("ApproveSuccessText") %>';
            }
            else {
                return '<% = GetLocalResourceObject("AbandonBatchText") %>';
            }
        }

      

         
        function AddBatchIssued_Click(fileGrid, rowIndex, colIndex) {
            var record = fileGrid.getStore().getAt(rowIndex); //Get the Record
            var MerBatchId = record.get("MERBATCHID");
            var Employee = Ext.data.Record.create([
                                 { name: 'ISSBANK', type: 'string' },
                                 { name: 'ISSBRANCHBANK', type: 'string' },
                                 { name: 'CARDNUM', type: 'string' },
                                 { name: 'CARDHOLDER', type: 'string' },
                                 { name: 'AMOUNT', type: "float" },
                                 { name: 'MERDETAILREFNUM', type: 'string' },
                                 { name: 'MERREMARK', type: 'string' }
                          ]);
            var da = [];
            var store = new Ext.data.GroupingStore({
                reader: new Ext.data.JsonReader({ fields: Employee }),
                data: da
            });

            var editor = new Ext.ux.grid.RowEditor({
                saveText: 'Update'
            });
            var cmm = [
            new Ext.grid.RowNumberer(),
            { header: '<% = GetLocalResourceObject("IssbankText") %>', dataIndex: "ISSBANK", sortable: true, width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("IssubbakText") %>', dataIndex: "ISSBRANCHBANK", width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("AccountText") %>', dataIndex: "CARDNUM", width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("IssNameText") %>', dataIndex: "CARDHOLDER", width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("MoneyText") %>', xtype: 'numbercolumn', dataIndex: "AMOUNT", format: '0,0.00', width: 100, editor: { xtype: 'numberfield', allowBlank: false, regex: /^\S+$/, minValue: 0.1, maxValue: 150000} },
            { header: '<% = GetLocalResourceObject("MerBatRefnumText") %>', dataIndex: "MERDETAILREFNUM", width: 100, editor: { xtype: 'textfield', allowBlank: false, regex: /^\S+$/} },
            { header: '<% = GetLocalResourceObject("MemoText") %>', dataIndex: "MERREMARK", width: 100, editor: { xtype: 'textfield'} }
         ];

            var grid = new Ext.grid.GridPanel({
                store: store,
                width: 700,
                height: 400,
                iframe: true,
                region: 'center',
                margins: '0 5 5 5',
                //                autoExpandColumn: 'name',
                plugins: [editor],
                view: new Ext.grid.GroupingView({
                    markDirty: false
                }),
                tbar: [{
                    iconCls: 'icon-user-add',
                    text: '<% = GetLocalResourceObject("AddRowText") %>',
                    handler: function () {
                        var e = new Employee({
                            ISSBANK: "",
                            ISSBRANCHBANK: "",
                            CARDNUM: "",
                            CARDHOLDER: "",
                            AMOUNT: 0.00,
                            MERDETAILREFNUM: "",
                            MERREMARK: ""
                        });
                        editor.stopEditing();
                        store.insert(0, e);
                        grid.getView().refresh();
                        grid.getSelectionModel().selectRow(0);
                        editor.startEditing(0);
                    }
                }, {
                    ref: '../removeBtn',
                    iconCls: 'icon-user-delete',
                    text: '<% = GetLocalResourceObject("DelRowText") %>',
                    disabled: true,
                    handler: function () {
                        editor.stopEditing();
                        var s = grid.getSelectionModel().getSelections();
                        for (var i = 0, r; r = s[i]; i++) {
                            store.remove(r);
                        }
                    }
                }],
                columns: cmm
            });
            grid.getSelectionModel().on('selectionchange', function (sm) {
                grid.removeBtn.setDisabled(sm.getCount() < 1);
            });
            var win = new Ext.Window({
                layout: 'form',
                width: 700,
                resizable: false,
                items: [{ items: [grid]}],
                buttonAlign: "center",
                buttons: [{ text: '<% = GetLocalResourceObject("SaveText") %>', width: '100',
                    handler: function () {
                        if (store.getCount() == 0) {
                            Ext.Msg.alert('<% = GetLocalResourceObject("PromptText") %>', '<% = GetLocalResourceObject("WriteRecordText") %>'); return false;
                        }
                        var array = new Array();
                        store.each(function (r) {
                            array.push(r.data);
                        });
                        var enable = true;
                        for (var i = 0; i < array.length; i++) {
                            var arr = array[i];
                            if (arr.ISSBANK == "" || arr.ISSBRANCHBANK == "" || arr.CARDNUM == "" || arr.CARDHOLDER == "" || arr.AMOUNT < 0.1 || arr.MERDETAILREFNUM == "") {
                                enable = false;
                            }
                        }
                        if (!enable) {
                            Ext.Msg.alert('<% = GetLocalResourceObject("PromptText") %>', '<% = GetLocalResourceObject("WriteFullDataText") %>'); return false;
                        }
                        Ext.Ajax.request({
                            url: "../Handler/Issued.ashx",
                            params: {
                                method: "AddIssuedInfo",
                                MerBatchId: MerBatchId,
                                dataStore: Ext.util.JSON.encode(array)
                            },
                            success: function (response, option) {
                                var result = Ext.util.JSON.decode(response.responseText);
                                if (result.Flag == true) {
                                    Ext.Msg.alert("Success", '<% = GetLocalResourceObject("AddRowSuccessText") %>');
                                    MerBatchStore.load();
                                    store.removeAll();
                                    win.hide();
                                } else {
                                    Ext.Msg.alert("Fail", result.RespMessage);
                                }
                            },
                            failure: function (response, option) {
                                Ext.Msg.alert("Failed", result.RespMessage);
                            }
                        });

                    }
                }]
            });
            win.show(Ext.getBody());
        }


        function btnUpload_Click() {
            if (Ext.getCmp("txtfile").isValid()) {
                var filename = Ext.getCmp("txtfile").getValue();
                var MerBatchId = Ext.get("txtMerBatchId").getValue();
                var filetype = filename.substring(filename.lastIndexOf('.') + 1);
                if (filetype == "txt") {
                    Ext.MessageBox.show({
                        title: '<% = GetLocalResourceObject("WaitText") %>',
                        msg: '<% = GetLocalResourceObject("UploadingText") %>',
                        width: 300,
                        progress: true,
                        closable: false
                    });
                    fileForm.getForm().submit({
                        url: "../handler/ApplyDownPayFiles.ashx?MerchantID=" + m_MerchantID + "&MerBatchId=" + MerBatchId,
                        success: function (form, action) {
                            var arr = Ext.util.JSON.decode(action.response.responseText);
                            if (arr.success == true) {
                                Ext.MessageBox.hide();
                                Ext.Msg.alert("Success", arr.msg);
                                MerBatchStore.load();
                            }
                            else if (arr.success == false) {
                                Ext.MessageBox.hide();
                                Ext.Msg.alert("Failed", arr.msg);
                            }
                        },
                        failure: function (form, action) {
                            var arr = Ext.util.JSON.decode(action.response.responseText);
                            Ext.MessageBox.hide();
                            Ext.Msg.alert("Fail", arr.msg);
                        }
                    });
                }
                else {
                    Ext.Msg.alert('<% = GetLocalResourceObject("WarnText") %>', '<% = GetLocalResourceObject("WrongFormatText") %>');
                }
            }
            else {
                Ext.Msg.alert('<% = GetLocalResourceObject("PromptText") %>', '<% = GetLocalResourceObject("SelectDocText") %>');
            }
        }

        //加载余额信息
        function pageinit() {
            Ext.Ajax.request({
                url: "../handler/DownPay.ashx",
                params: {
                    "method": "QueryAccountInfo"
                },
                success: function (response, option) {
                    var result = Ext.util.JSON.decode(response.responseText);
                    if (result.Flag) {
                        SelectCurrency = result.Currency;
                        MinSettleAmount = result.MinSettleAccount;
                        ReserveAmount = result.ReserveAmount
                        SettleAccountID = result.Account[0].ACCOUNTID;
                        var html = '';
                        html = '<span style="line-height:20px;font-size:12px;"><table><tr>';
                        html += '<td><% = GetLocalResourceObject("AccountremainText") %>:&nbsp;' + result.Account[0].CURRENCY + '&nbsp;<strong>' + (result.Account[0].SETTLEBALANCE).toFixed(2) + '</strong>&nbsp;&nbsp;&nbsp;</td>';
                        html += '<td></td></tr></table>';
                        label.setText(html, false);
                        Ext.override(Ext.form.Label, {
                            setText: function (t, encode) {
                                this[encode !== false ? 'text' : 'html'] = t;
                                delete this[encode === false ? 'text' : 'html'];
                                if (this.rendered) {
                                    this.el.dom.innerHTML = encode !== false ? Ext.util.Format.htmlEncode(t) : t;
                                }
                                return this;
                            }
                        });
                    }
                    else {
                        html = '<span style="color:red;font-size:12px;"><% = GetLocalResourceObject("OpenAccountText") %></span><br><br>';
                        label.dom.innerHTML = html;
                    }
                },
                failure: function () {
                }
            });
        }

    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="bodyContent" runat="server">
    <div id="dvAccountFlow">
    </div>
    <div id="dvMerIssuedInfo">
    </div>
    <div id="dvAddMerIssuedInfo">
    </div>
    <script type="text/javascript">
        Ext.QuickTips.init();
        var label = new Ext.form.Label({
            text: ''
        });
        pageinit();
        var proText = '<% = GetLocalResourceObject("AccountInfoText") %>';
        //     label.dom.innerHTML = label.dom.innerHTML + proText;
        //账户信息
        var infofrm = new Ext.Panel({
            id: "Infofrm",
            title: '<% = GetLocalResourceObject("AccountInfoText") %>',
            renderTo: "dvAccountFlow",
            autoHeight: true,
            frame: true,
            layout: "fit",
            width: m_PageWidth,
            items: [label]
        });

        var MerBatchStore = new Ext.data.JsonStore
           ({
               url: "../handler/Issued.ashx",
               root: "ResultData",
               totalProperty: 'ToTalRecord',
               listeners: {
                   beforeload: function () {
                       this.baseParams = {
                           "method": "QueryMerBatchIssuedInfo"
                       };
                   }
               },
               fields: ["CREATEDATE", "MERBATCHID", "TOTALCOUNT", "TOTALAMOUNT", "MERBATREFNUM", "APPROVESTATUS"]
           });
           MerBatchStore.load();
        //商户未审核下发批次
//        if (MerBatchStore.ResultData) {
            
            var gvResult = new Ext.grid.GridPanel
        ({
            id: "gvResult",
            title: '<% = GetLocalResourceObject("NoApproveIssuedBatchText") %>',
            renderTo: "dvMerIssuedInfo",
            store: MerBatchStore,
            width: m_PageWidth,
            height: 420,
            stripeRows: true,
            trackMouseOver: true,
            viewConfig: {
                forceFit: true,
                scrollOffset: 0
            },
            loadMask: { msg: '<% = GetLocalResourceObject("SearchingText") %>' },
            frame: true,
            columns:
                    [
                        new Ext.grid.RowNumberer(),
                        { header: '<% = GetLocalResourceObject("CreateDateText") %>', dataIndex: "CREATEDATE", width: 100, sortable: true, renderer: function (v) { return getFormatDate(v, "yyyy-MM-dd HH:mm:ss"); } },
                        { header: '<% = GetLocalResourceObject("MerBatchIdText") %>', dataIndex: "MERBATCHID", width: 100 },
                        { header: '<% = GetLocalResourceObject("TotalCountText") %>', dataIndex: "TOTALCOUNT", width: 100 },
                        { header: '<% = GetLocalResourceObject("TotalAmountText") %>', dataIndex: "TOTALAMOUNT", width: 80, renderer: function (v) { return v.toFixed(2) } },
                        { header: '<% = GetLocalResourceObject("MerBatRefnumText") %>', dataIndex: "MERBATREFNUM", width: 100 },
                        { header: '<% = GetLocalResourceObject("ApproveStatusText") %>', dataIndex: "APPROVESTATUS", width: 80, sortable: true, renderer: ConvertMerApproveStatus },
                        { header: '<% = GetLocalResourceObject("ActionText") %>', xtype: 'actioncolumn', width: 100,
                            items: [
                             {
                                 icon: '../Resource/Script/ExtJS/resources/images/default/dd/drop-yes.gif',
//                                 text: '<% = GetLocalResourceObject("AddBatchIssuedText") %>',
                                 tooltip: '<% = GetLocalResourceObject("AddBatchIssuedText") %>',
                                 handler: AddBatchIssued_Click//详细
                             }
                             ]
                        }
                    ],
            bbar: new Ext.PagingToolbar //分页
                    ({
                        pageSize: m_pageSize,
                        store: MerBatchStore,
                        displayInfo: true
                    }),
            ds: MerBatchStore,
            store: MerBatchStore
        });
//        }
        //       
       

        //文件下发
        var fileForm = new Ext.form.FormPanel({
            id: "frm2",
            autoHeight: true,
            frame: true,
            fileUpload: true,
            items: [
             { layout: "form", border: false, items: [{ html: '<div><span style="color:red"><% = GetLocalResourceObject("FormatNeedText") %></br><% = GetLocalResourceObject("FormatStringText") %></br><% = GetLocalResourceObject("DocModelText") %></span>&nbsp;&nbsp;&nbsp;<a href="../DownLoad/DownPayApply.txt" target="_blank"><% = GetLocalResourceObject("DownloadText") %></a>&nbsp;&nbsp;(<% = GetLocalResourceObject("AsaveText") %>)</br></div><br>'}] },
             { layout: "form", border: false, items: [{ html: '<div><% = GetLocalResourceObject("MerBatchIdText") %><input id="txtMerBatchId" type="text" />&nbsp;<% = GetLocalResourceObject("MerBatchIdsText") %></div>'}] },
             { layout: "column", border: false, items: [
             { columnWidth: .3, layout: 'form', labelWidth: 70, border: false, items: [{ xtype: "textfield", anchor: '98%', inputType: 'file', allowBlank: false, regex: /^\S+$/, blankText: '<% = GetLocalResourceObject("SelectDocUText") %>', id: "txtfile", fieldLabel: '<% = GetLocalResourceObject("UpFileText") %>'}] },
             { columnWidth: .7, layout: 'form', border: false, items: [{ xtype: "button", anchor: '10%', id: "btnUpload", text: '<% = GetLocalResourceObject("UpText") %>', handler: btnUpload_Click}] }
             ]
             },
            { layout: "form", border: false, items: [{ html: '<div><span style="color:red;font-size:12px;"><% = GetLocalResourceObject("TipsText") %></span></div>'}] }
        ]
        });

        //手动下发
        
//            var data = [{ ISSBANK: "Issbank", ISSBRANCHBANK: "issbanchbank", CARDNUM: "cardnum", CARDHOLDER: "cardholder", AMOUNT: 8.56, MERDETAILREFNUM: "merdetailrefunm", MERREMARK: "merremark"}];
            var data = [];
            var ds = new Ext.data.JsonStore({
                data: data,
                fields: ["ISSBANK", "ISSBRANCHBANK", "CARDNUM", "CARDHOLDER", { name: "AMOUNT", type: "float" }, "MERDETAILREFNUM", "MERREMARK"]
            });
            var cm = new Ext.grid.ColumnModel([
            new Ext.grid.RowNumberer(),
            { header: '<% = GetLocalResourceObject("IssbankText") %>', dataIndex: "ISSBANK", sortable: true, width: 100, editor: new Ext.form.TextField({ allowBlank: false, regex: /^\S+$/ }) },
            { header: '<% = GetLocalResourceObject("IssubbakText") %>', dataIndex: "ISSBRANCHBANK", width: 100, editor: new Ext.form.TextField({ allowBlank: false, regex: /^\S+$/ }) },
            { header: '<% = GetLocalResourceObject("AccountText") %>', dataIndex: "CARDNUM", width: 100, editor: new Ext.form.TextField({ allowBlank: false, regex: /^\S+$/ }) },
            { header: '<% = GetLocalResourceObject("IssNameText") %>', dataIndex: "CARDHOLDER", width: 100, editor: new Ext.form.TextField({ allowBlank: false, regex: /^\S+$/ }) },
            { header: '<% = GetLocalResourceObject("MoneyText") %>', dataIndex: "AMOUNT", width: 100, editor: new Ext.form.NumberField({ align: 'right', allowBlank: false, regex: /^\S+$/, minValue: 0.1, allowNegative: false }) },
            { header: '<% = GetLocalResourceObject("MerBatRefnumText") %>', dataIndex: "MERDETAILREFNUM", width: 100, editor: new Ext.form.TextField({ allowBlank: false, regex: /^\S+$/ }) },
            { header: '<% = GetLocalResourceObject("MemoText") %>', dataIndex: "MERREMARK", width: 100, editor: new Ext.form.TextField({ }) }
         ]);


            var manualForm = new Ext.grid.EditorGridPanel({
                width: 700,
                height: 350,
                frame: true,
                //licksToEdit: 2,
                store: ds,
                cm: cm
            });

            var manualAllForm = new Ext.FormPanel({
                id: "frm3",
                autoHeight: true,
                width: 720,
                frame: true,
                items: [
                   new Ext.form.NumberField({
                       id: "txtIssuedNum",
                       fieldLabel: '<% = GetLocalResourceObject("WriteAddRecordText") %>',
                       allowDecimals: false,               //不允许输入小数  
                       nanText: '<% = GetLocalResourceObject("WriteIntText") %>',           //无效数字提示  
                       allowNegative: false,              //不允许输入负数  
                       maxValue: 100,                       //最大值  
                       minValue: 1                      //最小值                
                   }),
                  new Ext.Button({
                      text: '<% = GetLocalResourceObject("SaveText") %>',
                      handler: function () {
                          var num = Ext.getCmp("txtIssuedNum").getValue();
                          if (num < 1) return false;
                          var count = ds.getCount();

                          if (count == num) { return false; }
                          else if (count < num) {
                              var o = num - count;
                              for (var i = 0; i < o; i++) {
                                  var iss = new ds.recordType({
                                      ISSBANK: "",
                                      ISSBRANCHBANK: "",
                                      CARDNUM: "",
                                      CARDHOLDER: "",
                                      AMOUNT: 0.00,
                                      MERDETAILREFNUM: "",
                                      MERREMARK: ""
                                  });
                                  ds.addSorted(iss);
                              }
                          }
                          else {
                              var oo = count - num;
                              for (var i = 0; i < oo; i++) {
                                  ds.remove(ds.getAt(count - oo));
                              }
                          }

                      }
                  }),
              manualForm
               ],
                buttons: [{
                    text: '<% = GetLocalResourceObject("SaveInfoText") %>',
                    handler: function () {
                        var co = ds.getCount();
                        if (co == 0) { Ext.Msg.alert('<% = GetLocalResourceObject("WarnText") %>', '<% = GetLocalResourceObject("WriteRecordText") %>'); return false; }
                        var array = new Array();
                        ds.each(function (record) {
                            array.push(record.data);
                        });
                        var enable = true;
                        for (var i = 0; i < array.length; i++) {
                            var arr = array[i];
                            if (arr.ISSBANK == "" || arr.ISSBRANCHBANK == "" || arr.CARDNUM == "" || arr.CARDHOLDER == "" || arr.AMOUNT < 0.1 || arr.MERDETAILREFNUM == "") {
                                enable = false;
                            }
                        }
                        if (!enable) {
                            Ext.Msg.alert('<% = GetLocalResourceObject("PromptText") %>', '<% = GetLocalResourceObject("WriteFullDataText") %>'); return false;
                        }
                        Ext.Ajax.request({
                            url: "../Handler/Issued.ashx",
                            params: {
                                method: "SaveInfo",
                                dataStore: Ext.util.JSON.encode(array)
                            },
                            success: function (response, option) {
                                var result = Ext.util.JSON.decode(response.responseText);
                                if (result.Flag == true) {
                                    Ext.Msg.alert("Success", '<% = GetLocalResourceObject("IssuedSuccessText") %>');
                                    ds.removeAll();
                                    MerBatchStore.load();
                                } else {
                                    Ext.Msg.alert("Fail", result.RespMessage);
                                }
                            },
                            failure: function (response, option) {
                                Ext.Msg.alert("Failed", result.RespMessage);
                            }
                        });
                    }
                }, {
                    text: '<% = GetLocalResourceObject("SaveApproveText") %>',
                    handler: function () {
                        var co = ds.getCount();
                        if (co == 0) { Ext.Msg.alert('<% = GetLocalResourceObject("WarnText") %>', '<% = GetLocalResourceObject("WriteRecordText") %>'); return false; }
                        var array = new Array();
                        ds.each(function (record) {
                            array.push(record.data);
                        });
                        Ext.Ajax.request({
                            url: "../Handler/Issued.ashx",
                            params: {
                                method: "SaveApproveText",
                                dataStore: Ext.util.JSON.encode(array)
                            },
                            success: function (response, option) {
                                var result = Ext.util.JSON.decode(response.responseText);
                                if (result.Flag == true) {
                                    Ext.Msg.alert("Success", '<% = GetLocalResourceObject("IssuedSuccessText") %>');
                                    ds.removeAll();
                                } else {
                                    Ext.Msg.alert("Fail", result.RespMessage);
                                }
                            },
                            failure: function (response, option) {
                                Ext.Msg.alert("Failed", result.RespMessage);
                            }
                        });
                    }
                }]

            });
 

    Ext.onReady(function () {
        var tabsDemo = new Ext.TabPanel({
            renderTo: Ext.getBody(),
            activeTab: 0, //当前激活标签
            frame: true,
            height: 700,
            items: [{
                title: '<% = GetLocalResourceObject("FileIssuedText") %>',
                items: [fileForm]
            }, {
                title: '<% = GetLocalResourceObject("ManualIssuedText") %>',
                items: [manualAllForm]
            }]
        });
    });
    </script>
</asp:Content>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值