ExtJs 扩展 笔录1

  Ext.layout.SlideLayout.js Ext.namespace("Ext.layout"); Ext.layout.SlideLayout = Ext.extend(Ext.layout.FitLayout, { deferredRender : false, renderHidden : false, easing: "none", duration: .5, opacity: 1, setActiveItem : function(itemInt) { if (typeof(itemInt) == "string") { itemInt = this.container.items.keys.indexOf(itemInt); } else if (typeof(itemInt) == "object") { itemInt = this.container.items.items.indexOf(itemInt); } var item = this.container.getComponent(itemInt); if(this.activeItem != item) { if(this.activeItem) { if(item && (!item.rendered || !this.isValidParent(item, this.container))) { this.renderItem(item, itemInt, this.container.getLayoutTarget()); item.show(); } var s = [this.container.body.getX() - this.container.body.getWidth(), this.container.body.getX() + this.container.body.getWidth()]; this.activeItem.el.shift({ duration: this.duration, easing: this.easing, opacity: this.opacity, x:(this.activeItemNo flex: 1, layoutConfig: { easing: "none", duration: .5, opacity: .1 }, activeItem: 0, listeners: { "add": function(thisPanel, addedCmp, Index) { addedCmp.initialConfig.index = Index; } } }); if (this.steps) { if (this.steps.length > 0) { for (var i = 0; i ",{ id: "move-next", text: "下一步", disabled: false, handler: this.navHandler.createDelegate(this, [1]) },{ id: "finish", text: "完成", disabled: false, hidden: true, handler: function() { this.ownerCt.ownerCt.finish(); } }] }; Ext.apply(this, Ext.apply(this.initialConfig, config)); Ext.ux.Tutorial.superclass.initComponent.apply(thi s, arguments); this.on("show", this.onShow, this); }, /** * */ onShow: function() { Ext.ux.Tutorial.superclass.onShow.apply(this, arguments); var tmp = "步骤 1/"+this.cPanel.items.length+" \""+this.cPanel.layout.activeItem.initialConfig.ti tle1+"\""; Ext.getCmp("pbar").updateProgress((this.cPanel.lay out.activeItem.initialConfig.index+1)/this.cPanel.i tems.length, tmp); }, /** * */ navHandler: function(direction) { currStepPanel = this.cPanel.layout.activeItem; otherStepPanel = Ext.getCmp("card-"+(currStepPanel.initialConfig.in dex+direction)); var tmp = "步骤 "+(otherStepPanel.initialConfig.index+1)+"/"+this. cPanel.items.length+" "+otherStepPanel.initialConfig.title1; Ext.getCmp("pbar").updateProgress((otherStepPanel. initialConfig.index+1)/this.cPanel.items.length, tmp); this.cPanel.getLayout().setActiveItem(currStepPane l.initialConfig.index+direction); if (otherStepPanel.initialConfig.index === 0) { Ext.getCmp("move-prev").disable(); Ext.getCmp("move-prev").hide(); Ext.getCmp("cancel").enable(); Ext.getCmp("cancel").show(); } else { Ext.getCmp("move-prev").enable(); Ext.getCmp("move-prev").show(); Ext.getCmp("cancel").disable(); Ext.getCmp("cancel").hide(); } if (otherStepPanel.initialConfig.index === (this.cPanel.items.length-1)) { Ext.getCmp("move-next").disable(); Ext.getCmp("move-next").hide(); Ext.getCmp("finish").enable(); Ext.getCmp("finish").show(); } else { Ext.getCmp("move-next").enable(); Ext.getCmp("move-next").show(); Ext.getCmp("finish").disable(); Ext.getCmp("finish").hide(); } }, /** * */ createSteps: function(i) { if (!this.steps[i].bodyStyle) { this.steps[i].bodyStyle = ""; } if (!this.steps[i].cls) { this.steps[i].cls = ""; } this.cPanel.add(new Ext.Panel({ id: "card-"+i, frame: false, border:false, bodyStyle: this.steps[i].bodyStyle, cls: this.steps[i].cls, title1: this.steps[i].title, items:this.steps[i].items // html: this.steps[i].html })); } }); Ext.ComponentMgr.registerType("ux-tutorial", Ext.ux.Tutorial); ------------------------------------------------- main.js Ext.onReady(function() { var finishFn = function() { alert("这里提交数据..."); } var cancelFn = function() { win.close(); } var win = new Ext.ux.Tutorial({ id: "simple-tutorial", title: "布局", width: 500, height: 350, cancel: cancelFn, finish: finishFn, steps: [{ title: "第一步(基本信息)", border: false, layout: "fit", items: { xtype: "form", border: false, labelWidth: 60, bodyStyle: "padding:20px;", defaults: { defaults: { border: false, defaults: { border: false} }, border: false }, items: [ { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "姓名", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "年龄", anchor: "90%" }, columnWidth: .5 } ] }, { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "性别", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "籍贯", anchor: "90%" }, columnWidth: .5 } ] }, { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "学历", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "地址", anchor: "90%" }, columnWidth: .5 } ] } ] } }, { title: "第二步(详细信息)", border: false, layout: "fit", items: { xtype: "form", border: false, labelWidth: 60, bodyStyle: "padding:20px;", defaults: { defaults: { border: false, defaults: { border: false} }, border: false }, items: [ { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "公司", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "邮箱", anchor: "90%" }, columnWidth: .5 } ] }, { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "网站", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "行业", anchor: "90%" }, columnWidth: .5 } ] }, { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "身高", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "体重", anchor: "90%" }, columnWidth: .5 } ] } ] } }, { title: "第三步(扩展信息)", border: false, layout: "fit", items: { xtype: "form", border: false, labelWidth: 60, bodyStyle: "padding:20px;", defaults: { defaults: { border: false, defaults: { border: false} }, border: false }, items: [ { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "扩展信息1", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "扩展信息2", anchor: "90%" }, columnWidth: .5 } ] }, { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "扩展信息3", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "扩展信息4", anchor: "90%" }, columnWidth: .5 } ] }, { layout: "column", items: [ { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "扩展信息5", anchor: "90%" }, columnWidth: .5 }, { layout: "form", items: { xtype: "textfield", name: "", fieldLabel: "扩展信息6", anchor: "90%" }, columnWidth: .5 } ] } ] } }] }).show(); }); ----------------------------------- index.html ExtJS Tutorial Extension css/ext-all.css" mce_href="Ext/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值