博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Extjs editor plugins
阅读量:5010 次
发布时间:2019-06-12

本文共 7517 字,大约阅读时间需要 25 分钟。

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" %>

 

转载于:https://www.cnblogs.com/hongdada/archive/2013/03/08/2950087.html

你可能感兴趣的文章
15套精美的免费界面设计 PSD 素材【免费下载】
查看>>
uva 11995 判别数据类型
查看>>
50张美轮美奂的地球风景照片欣赏(下篇)
查看>>
ACM/ICPC 之 模拟 (HNUOJ 13391-换瓶模拟)
查看>>
JavaWeb学习——JSP基础
查看>>
Eclipse tomcat server 无法添加项目
查看>>
黑寡妇黄飞鸿
查看>>
leetcode 217 Contains Duplicate 数组中是否有重复的数字
查看>>
The Ctrl & CapsLock `problem'
查看>>
MyBatis学习总结(二)——使用MyBatis对表执行CRUD操作
查看>>
linux故障判断
查看>>
Leetcode 23. Merge k Sorted Lists(python)
查看>>
Java进阶知识点6:并发容器背后的设计理念 - 锁分段、写时复制和弱一致性
查看>>
Shell编程之批量安装服务脚本实例
查看>>
tomcat 报错处理
查看>>
使用iframe给页面的localStorage扩容
查看>>
第四次作业
查看>>
Java 内存映射文件
查看>>
衡量软件性能三大常用指标及其相互关系
查看>>
#网页中动态嵌入PDF文件/在线预览PDF内容#
查看>>