EXt JS 验证 如图,选中一条记录,然后点击上面的出金就会弹出下面的小框,现在需要实现一个提示,就是在文本框输入数字时会自动显示汉字大写的金额,这个提示在文本框的后面或下面都可以(圆圈的地方),,现在这个文本框不能输入小数点,想改成只能输入一个位小数。。本人,只是能看懂一点EXT.JS ,所以请大神帮忙, 下面是整个页面的JS ExtJS验证 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Ext.onReady(function () { Ext.QuickTips.init(); document.oncontextmenu = new Function("event.returnValue=false;"); document.onselectstart = new Function("event.returnValue=false;"); var uid = ''; var uname = ''; var st = '通过'; //============================ store begin======================================== var store = new Ext.data.Store({ proxy: new Ext.data.WCFHttpProxy({ url: '../DataService.svc/GetTXT2' }), reader: new Ext.data.WCFJsonReader({ totalProperty: 'RecordCount', root: "Data", fields: [ { name: 'UserId' }, { name: 'NickName' }, { name: 'Usex' }, { name: 'Legally' }, { name: 'Bank' }, { name: 'Account' }, { name: 'DoBankroll' }, { name: 'FrozenCapital' }, { name: 'State' }, { name: 'FundApplication' }, ] }), romoteSort: true }); store.on('beforeload', function () { this.baseParams = { userId: uid, userName: uname, state: st }; }); store.setDefaultSort('UserId', 'desc'); var request = { start: 0, limit: 18, userId: uid, userName: uname, state: st }; store.load({ params: request }); //============================ store end======================================== //============================ gridPanel begin======================================== var sm = new Ext.grid.CheckboxSelectionModel(); var nm = new Ext.grid.RowNumberer(); var cm = new Ext.grid.ColumnModel([nm, sm, { header: '用户登录ID', dataIndex: 'UserId', sortable: true, width: 60 }, { header: '用户名称', dataIndex: 'NickName', sortable: true, width: 50 }, { header: "开户银行", dataIndex: 'Bank', sortable: true, width: 100 }, { header: "开户账号", dataIndex: 'Account', sortable: true, width: 100 }, { header: "状态", dataIndex: 'State', sortable: true, width: 100 }, { header: "发生资金", dataIndex: 'FundApplication', sortable: true, width: 100 }, { header: "用户可用资金", dataIndex: 'DoBankroll', sortable: true, width: 70 }, { header: "用户冻结资金", dataIndex: 'FrozenCapital', sortable: true, width: 70 } ]); cm.defaultSortable = true; var grid = new Ext.grid.GridPanel({ el: 'Panel', bodyStyle: 'width:100%', autoWidth: true, autoHeight: true, store: store, key: 'UserID', showRowNumber: true, showSelectionModel: true, columns: null, cm: cm, trackMouseOver: false, sm: sm, loadMask: true, viewConfig: { forceFit: true }, tbar: [{ text: '用户ID:', tooltip: '输入查询用户ID' }, { xtype: 'field', id: 'userId' }, '-', { text: '用户名:', tooltip: '输入查询用户名' }, { xtype: 'field', id: 'userName' }, '-', { xtype: 'button', tooltip: '点击搜索用户', text: '搜索用户', handler: search }, '-', { text: '客户出金', tooltip: '客户转出资金', handler: handleOutEdit }, '-', { xtype: 'button', text: '初始化天下通密码', tooltip: '初始化天下通密码', handler: InitTxPwd }], bbar: new Ext.PagingToolbar({ pageSize: 18, store: store, displayInfo: true, displayMsg: 'Displaying topics {0} - {1} of {2}', emptyMsg: "No topics to display" }) }); grid.render(); //============================ gridPanel end======================================== function search() { uname = Ext.getCmp("userName").getValue(); uid = Ext.getCmp("userId").getValue(); var searchParam = { start: 0, limit: 18, userId: uid, userName: uname, state: st }; store.load({ params: searchParam }); } var TxOutForm = new Ext.FormPanel({ frame: true, layout: 'form', labelAlign: 'right', labelWidth: 90, width: 450, items: new Ext.form.FieldSet({ title: '出金信息', height: 130, bodyStyle: 'padding:2px', autoHeigh: true, defaults: { width: 175 }, defaultType: 'textfield', items: [ { fieldLabel: '用户ID', name: 'UserId', blankText: '不能为空', readOnly: true, allowBlank: false }, { fieldLabel: '用户名称', name: 'UserName', readOnly: true }, { fieldLabel: '账户余额', name: 'yue', readOnly: true }, { fieldLabel: '出金金额', name: 'DoBankroll', blankText: '请填写出金金额', allowBlank: false, regex: /^\d+$/, regexText: '请输入正确的数据类型', vtype: 'alphanum' }] }) }); var OutTxWin; function handleOutEdit() { var selectedKeys = grid.selModel.selections.keys; if (selectedKeys.length != 1) { Ext.MessageBox.alert('提示', '请选择一个出金的客户!'); } else { var recordtoedit = grid.getSelectionModel().getSelected(); var UserID = recordtoedit.get('UserId').toString(); var UserName = recordtoedit.get('NickName').toString(); var Yue = recordtoedit.get('DoBankroll').toString(); TxOutForm.findByType("textfield")[0].setValue(UserID); TxOutForm.findByType("textfield")[1].setValue(UserName); TxOutForm.findByType("textfield")[2].setValue(Yue); OutTxWin = new Ext.Window({ title: '客户出金', layout: 'fit', width: 350, height: 240, plain: true, closeAction: 'hide', items: TxOutForm, buttons: [{ text: '保 存', handler: TxOutRecord }, { text: '取 消', handler: function () { OutTxWin.hide(); } }] }); //window end OutTxWin.show(this); } } function TxOutRecord(btn) { if (TxOutForm.form.isValid()) { Ext.MessageBox.show({ msg: '正在请求数据,请请稍', progressText: '正在请求数据', width: 300, wait: true, waitConfig: { interval: 200 } }); var formvalue = TxOutForm.form.getValues(); var request = { emp: ConvertFormValue(formvalue, '') }; Ext.Ajax.request({ url: '../FundService.svc/outMoney', params: Ext.util.JSON.encode(request), callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var alertcontent = ConvertResponseText(response.responseText, '', true, false); Ext.MessageBox.alert('操作成功', alertcontent); TxOutForm.getForm().reset(); OutTxWin.hide(); } else { Ext.MessageBox.hide(); Ext.MessageBox.alert('操作失败', response.responseText); } }, failure: function (response, options) { Ext.MessageBox.hide(); ReturnValue = Ext.MessageBox.alert('警告', '出现异常错误!请联系管理员!'); }, success: function (response, options) { Ext.MessageBox.hide(); store.reload(); } }); } } function InitTxPwd() { var selectedKeys = grid.selModel.selections.keys; if (selectedKeys.length != 1) { Ext.MessageBox.alert('提示', '请先选择一个客户!'); return; } else { var recordtoedit = grid.getSelectionModel().getSelected(); var UserID = recordtoedit.get('UserId').toString(); Ext.MessageBox.show({ msg: '正在请求数据,请请稍', progressText: '正在请求数据', width: 300, wait: true, waitConfig: { interval: 200 } }); var request = { UserID: UserID }; Ext.Ajax.request({ url: '../FundService.svc/InitTxPwd', params: Ext.util.JSON.encode(request), callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var alertcontent = ConvertResponseText(response.responseText, '', true, false); Ext.MessageBox.alert('操作成功', alertcontent); } else { Ext.MessageBox.hide(); Ext.MessageBox.alert('操作失败', response.responseText); } }, failure: function (response, options) { Ext.MessageBox.hide(); ReturnValue = Ext.MessageBox.alert('警告', '出现异常错误!请联系管理员!'); }, success: function (response, options) { Ext.MessageBox.hide(); } }); } }}); 根据复选框值进行判断 setTimeout传参数问题 关于js类的继承问题 两个Ext.tree.TreePanel 求一正则 匹配日期数字的 怎样用js来实现下面类似菜单的效果?求代码,谢谢!! 有没有不用window.open来让窗口全屏显示的方法? 求一段简单的小代码(100分) 用了DHTML里的insertCell函数,可以插入多行,可是。。。。。。 关于js控制css属性的问题 jquery 图片飘落效果怎么实现? 请问下,怎么使用easyUI?
Ext.QuickTips.init();
document.oncontextmenu = new Function("event.returnValue=false;");
document.onselectstart = new Function("event.returnValue=false;");
var uid = '';
var uname = '';
var st = '通过'; //============================ store begin========================================
var store = new Ext.data.Store({
proxy: new Ext.data.WCFHttpProxy({
url: '../DataService.svc/GetTXT2'
}),
reader: new Ext.data.WCFJsonReader({
totalProperty: 'RecordCount',
root: "Data",
fields: [
{ name: 'UserId' },
{ name: 'NickName' },
{ name: 'Usex' },
{ name: 'Legally' },
{ name: 'Bank' },
{ name: 'Account' },
{ name: 'DoBankroll' },
{ name: 'FrozenCapital' },
{ name: 'State' },
{ name: 'FundApplication' }, ]
}),
romoteSort: true
}); store.on('beforeload', function () {
this.baseParams = { userId: uid, userName: uname, state: st };
});
store.setDefaultSort('UserId', 'desc');
var request = { start: 0, limit: 18, userId: uid, userName: uname, state: st };
store.load({ params: request });
//============================ store end======================================== //============================ gridPanel begin========================================
var sm = new Ext.grid.CheckboxSelectionModel();
var nm = new Ext.grid.RowNumberer();
var cm = new Ext.grid.ColumnModel([nm, sm, {
header: '用户登录ID',
dataIndex: 'UserId',
sortable: true,
width: 60
},
{
header: '用户名称',
dataIndex: 'NickName',
sortable: true,
width: 50
}, {
header: "开户银行",
dataIndex: 'Bank',
sortable: true,
width: 100
}, {
header: "开户账号",
dataIndex: 'Account',
sortable: true,
width: 100
}, {
header: "状态",
dataIndex: 'State',
sortable: true,
width: 100
}, {
header: "发生资金",
dataIndex: 'FundApplication',
sortable: true,
width: 100
}, {
header: "用户可用资金",
dataIndex: 'DoBankroll',
sortable: true,
width: 70
}, {
header: "用户冻结资金",
dataIndex: 'FrozenCapital',
sortable: true,
width: 70
}
]);
cm.defaultSortable = true;
var grid = new Ext.grid.GridPanel({
el: 'Panel',
bodyStyle: 'width:100%',
autoWidth: true,
autoHeight: true,
store: store,
key: 'UserID',
showRowNumber: true,
showSelectionModel: true,
columns: null,
cm: cm,
trackMouseOver: false,
sm: sm,
loadMask: true,
viewConfig: {
forceFit: true
},
tbar: [{
text: '用户ID:',
tooltip: '输入查询用户ID'
}, {
xtype: 'field',
id: 'userId'
}, '-', {
text: '用户名:',
tooltip: '输入查询用户名'
}, {
xtype: 'field',
id: 'userName'
}, '-', {
xtype: 'button',
tooltip: '点击搜索用户',
text: '搜索用户',
handler: search
}, '-', {
text: '客户出金',
tooltip: '客户转出资金',
handler: handleOutEdit
}, '-', {
xtype: 'button',
text: '初始化天下通密码',
tooltip: '初始化天下通密码',
handler: InitTxPwd
}],
bbar: new Ext.PagingToolbar({
pageSize: 18,
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display" })
});
grid.render();
//============================ gridPanel end======================================== function search() {
uname = Ext.getCmp("userName").getValue();
uid = Ext.getCmp("userId").getValue();
var searchParam = { start: 0, limit: 18, userId: uid, userName: uname, state: st };
store.load({ params: searchParam });
} var TxOutForm = new Ext.FormPanel({
frame: true,
layout: 'form',
labelAlign: 'right',
labelWidth: 90,
width: 450,
items: new Ext.form.FieldSet({
title: '出金信息',
height: 130,
bodyStyle: 'padding:2px',
autoHeigh: true,
defaults: { width: 175 },
defaultType: 'textfield',
items: [
{
fieldLabel: '用户ID',
name: 'UserId',
blankText: '不能为空',
readOnly: true,
allowBlank: false
}, {
fieldLabel: '用户名称',
name: 'UserName',
readOnly: true
}, {
fieldLabel: '账户余额',
name: 'yue',
readOnly: true }, {
fieldLabel: '出金金额',
name: 'DoBankroll',
blankText: '请填写出金金额',
allowBlank: false,
regex: /^\d+$/,
regexText: '请输入正确的数据类型',
vtype: 'alphanum'
}]
}) });
var OutTxWin;
function handleOutEdit() {
var selectedKeys = grid.selModel.selections.keys;
if (selectedKeys.length != 1) {
Ext.MessageBox.alert('提示', '请选择一个出金的客户!');
} else {
var recordtoedit = grid.getSelectionModel().getSelected();
var UserID = recordtoedit.get('UserId').toString();
var UserName = recordtoedit.get('NickName').toString();
var Yue = recordtoedit.get('DoBankroll').toString();
TxOutForm.findByType("textfield")[0].setValue(UserID);
TxOutForm.findByType("textfield")[1].setValue(UserName);
TxOutForm.findByType("textfield")[2].setValue(Yue);
OutTxWin = new Ext.Window({
title: '客户出金',
layout: 'fit',
width: 350,
height: 240,
plain: true,
closeAction: 'hide',
items: TxOutForm,
buttons: [{
text: '保 存',
handler: TxOutRecord
}, {
text: '取 消',
handler: function () {
OutTxWin.hide();
}
}]
}); //window end
OutTxWin.show(this);
}
} function TxOutRecord(btn) {
if (TxOutForm.form.isValid()) {
Ext.MessageBox.show({
msg: '正在请求数据,请请稍',
progressText: '正在请求数据',
width: 300,
wait: true,
waitConfig: { interval: 200 }
});
var formvalue = TxOutForm.form.getValues();
var request = { emp: ConvertFormValue(formvalue, '') };
Ext.Ajax.request({
url: '../FundService.svc/outMoney',
params: Ext.util.JSON.encode(request),
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var alertcontent = ConvertResponseText(response.responseText, '', true, false);
Ext.MessageBox.alert('操作成功', alertcontent);
TxOutForm.getForm().reset();
OutTxWin.hide();
} else {
Ext.MessageBox.hide();
Ext.MessageBox.alert('操作失败', response.responseText);
}
},
failure: function (response, options) {
Ext.MessageBox.hide();
ReturnValue = Ext.MessageBox.alert('警告', '出现异常错误!请联系管理员!');
},
success: function (response, options) {
Ext.MessageBox.hide();
store.reload();
}
});
}
}
function InitTxPwd() {
var selectedKeys = grid.selModel.selections.keys;
if (selectedKeys.length != 1) {
Ext.MessageBox.alert('提示', '请先选择一个客户!');
return;
} else {
var recordtoedit = grid.getSelectionModel().getSelected();
var UserID = recordtoedit.get('UserId').toString(); Ext.MessageBox.show({
msg: '正在请求数据,请请稍',
progressText: '正在请求数据',
width: 300,
wait: true,
waitConfig: { interval: 200 }
}); var request = { UserID: UserID };
Ext.Ajax.request({
url: '../FundService.svc/InitTxPwd',
params: Ext.util.JSON.encode(request),
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var alertcontent = ConvertResponseText(response.responseText, '', true, false);
Ext.MessageBox.alert('操作成功', alertcontent);
} else {
Ext.MessageBox.hide();
Ext.MessageBox.alert('操作失败', response.responseText);
}
},
failure: function (response, options) {
Ext.MessageBox.hide();
ReturnValue = Ext.MessageBox.alert('警告', '出现异常错误!请联系管理员!');
},
success: function (response, options) {
Ext.MessageBox.hide(); }
});
}
}
});