EXT自定义窗体加载数据
来源:互联网 发布:网络理财官方网站 编辑:程序博客网 时间:2024/05/17 21:37
我定义了一个自定义窗体,代码如下,其中有一个dataurl属性,是自定义的,主要的功能就是传递自定义窗体要加载数据的url
在工具栏的按钮单击事件以后加载数据,代码如下:
多了一个mode:'local'就好了,后来在ff里面运行的时候,发现在combo里面输入4个字符,列表就能显示出来,原来combo默认会从远程取数据
- EditBranchWindow = Ext.extend(Ext.Window, {
- title : '修改',
- width : 350,
- height : 140,
- dataurl : '',
- collapsible : true,
- modal : true,
- defaults : {
- border : false
- },
- buttonAlign : 'center',
- createFormPanel : function() {
- var myproxy = new Ext.data.HttpProxy({
- url : this.dataurl,
- method : 'POST'
- })
- var myds = new Ext.data.Store({
- proxy : myproxy,
- reader : new Ext.data.JsonReader({
- root : 'users',
- totalProperty : 'total',
- successProperty : 'success',
- id : 'id'
- }, [{
- name : 'name',
- mapping : 'name'
- }, {
- name : 'email',
- mapping : 'email'
- }, {
- name : 'id',
- mapping : 'id'
- }])
- });
- /*
- * var sstore = new Ext.data.SimpleStore({ proxy:proxy });
- */
- myds.load();
- var mcombo = new Ext.form.ComboBox({
- store : myds,
- displayField : 'name',
- emptyText : '请选择一个用户...',
- // valueField : 'id',
- fieldLabel : '支部管理员',
- id : 'master.id',
- name : 'master.id'
- });
- var editpanel = new Ext.form.FormPanel({
- bodyStyle : 'padding-top:6px',
- defaultType : 'textfield',
- labelAlign : 'right',
- labelWidth : 100,
- labelPad : 0,
- frame : true,
- defaults : {
- allowBlank : false,
- width : 158
- },
- items : [{
- name : 'branch.title',
- fieldLabel : '支部名称',
- blankText : '支部名称不能为空'
- }, mcombo]
- });
- return editpanel;
- },
- subdata : function() {
- if (this.fp.form.isValid()) {
- this.fp.form.submit({
- waitMsg : '正在提交数据...',
- url : 'saveBranch.action',
- success : function(form, action) {
- window.location.reload();
- },
- failure : function(form, action) {
- form.reset();
- Ext.MessageBox.show({
- title : '警告',
- msg : '发生错误!',
- buttons : Ext.MessageBox.OK,
- icon : Ext.MessageBox.ERROR
- });
- }
- });
- } else {
- Ext.MessageBox.alert('提示', '请填写完整');
- }
- },
- initComponent : function() {
- EditBranchWindow.superclass.initComponent.call(this);
- this.fp = this.createFormPanel();
- this.add(this.fp);
- this.addButton('提交', this.subdata, this);
- this.addButton('重置', function() {
- this.fp.form.reset();
- }, this);
- }
- });
在工具栏的按钮单击事件以后加载数据,代码如下:
- var newButtonclick = function() {
- var win = new EditBranchWindow({
- title : '添加',
- dataurl : 'new.action'
- });
- win.show();
- };
- var mcombo = new Ext.form.ComboBox({
- typeAhead: true,
- store : myds,
- displayField : 'name',
- emptyText : '请选择一个用户...',
- valueField : 'id',
- fieldLabel : '支部管理员',
- id : 'master.id',
- name : 'master.id',
- mode:'local'
- });
多了一个mode:'local'就好了,后来在ff里面运行的时候,发现在combo里面输入4个字符,列表就能显示出来,原来combo默认会从远程取数据
- EXT自定义窗体加载数据
- Ext 动态加载数据
- ext远程加载数据
- Ext combobox数据加载
- 打开加载模态窗体EXT
- Ext自动加载自定义组件
- Ext.js5(加载本地数据)(自定义模板完成自定义UI)(29)
- Ext 动态加载表单数据
- Ext Tree 异步加载数据
- Ext.js5(自定义的下拉列表模板)(从服务器加载数据)(28)
- Ext.FormPanel/Ext.form.FormPanel load data/加载数据
- Ext Grit动态加载xml数据
- Ext.tree.TreeLoader异步加载数据
- Ext 重新加载Combobox的数据
- Ext EditGrid 动态加载XML数据
- [Ext.Net]TreePanel 异步加载数据
- ext combobox动态加载数据库数据
- Ext.grid.Panel加载JSON数据
- nfor MyDay帮助企业专注于高效益工作
- C++中的vector&find_if
- 软件安装,卸载测试需要考虑的问题
- 如非饿死,切勿食蝇
- 常用HTML技巧总结
- EXT自定义窗体加载数据
- 微软官方的Visual Studio 控件命名规范
- 关于在Linux上启动J2ME及其emulator失败的解决办法(非原创)
- Shapefile文件格式详解
- href支持多句javascript
- Servlet3.0新规范(JSR-135)沉思(一) by Roy van Rijn
- 企业架构浪潮又起 看SOA究竟有什么魔力
- VS包加载失败 VS工具错误
- mapInfo文件格式详解