码迷,mamicode.com
首页 > Web开发 > 详细

ExtJs demo

时间:2016-05-08 16:53:14      阅读:405      评论:0      收藏:0      [点我收藏+]

标签:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="WebApplication1._default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link href="Extjs5/packages/ext-theme-neptune/build/resources/ext-theme-neptune-all.css" rel="stylesheet" />
    <script type="text/javascript" src="Extjs5/bootstrap.js"></script>
    <script type="text/javascript" src="Extjs5/packages/ext-locale/build/ext-locale-zh_CN.js"></script>
    <style type="text/css">
        .custom .x-progress-inner {
            height: 19px;
            background: #fff;
        }
        .custom .x-progress-bar {
            height: 17px;
            background: transparent url(images/y.gif) repeat-x 0 0;
            border-top: 1px solid #BEBEBE;
            border-bottom: 1px solid #EFEFEF;
            border-right: 0;
        }
    </style>
    <script src="Extjs5/vswd-ext_2.2.js"></script>
    <script type="text/javascript">
       Ext.define(MetroX.view.panel.BasicPanels, {
            extend: Ext.Container,
            xtype: basic-panels,
            width: 660,
            requires: [ Ext.layout.container.Table],
            layout: {
                type: table,
                columns: 3,
                tdAttrs: { style: padding: 10px; vertical-align: top; }
            },
            
            defaults: {
                xtype: panel,
                width: 200,
                height: 280,
                bodyPadding: 10
            },
            initComponent: function () {
                this.items = [
                    {
                        html: "demo"
                    },
                    {
                        title: Title,
                        html: "demo"
                    },
                    {
                        title: Collapsible,
                        collapsible: true,
                        html: "demo"
                    },
                    {
                        title: Tools,
                        collapsed: true,
                        collapsible: true,
                        width: 640,
                        html: "demo",
                        tools: [
                            { type: pin },
                            { type: refresh },
                            { type: search },
                            { type: save }
                        ],
                        colspan: 3
                    }
                ];

                this.callParent();
            }
            
        });
        Ext.onReady(function () {
            
            var win = Ext.create("Ext.window.Window", {
                height: 400,
                width: 600,
                title: "ExtJs5 窗口",
                collapsible: true,
                tools: [
                    { type: pin },
                    { type: refresh },
                    { type: search },
                    { type: save }
                ],
                items: [{ xtype: basic-panels}]
            }).show();

            var mypanels = Ext.create(MetroX.view.panel.BasicPanels);
            mypanels.render(Ext.getBody(),null);


            Ext.Msg.alert("HelloWord");
            //Ext.Msg.alert("HelloWorld!");
            //var win = new Ext.window.Window({
            //    height: 400,
            //    width: 600,
            //    title: "ExtJs5 窗口",
            //    layout:"fit"
            //});
            //win.show();

            //Ext.get("btnShowWin").on("click", function() {
            //    win.hide();
            //});
            /*
            var progressBar = new Ext.ProgressBar({
                text:"working...",
                width: 300,
                renderTo: ‘progressBar‘,
                cls:"custom"
            });

            progressBar.wait({
                duration: 10000,
                interval: 1000,
                increment: 10,
                text: "waitting...",
                scope: this,
                fn: function () {
                    progressBar.hide();
                    alert("Finesh.");
                }
            });*/

            //var progressBar = new Ext.ProgressBar({
            //    width: 300,
            //    renderTo: "progressBar"
            //});


            //var count = 0;
            //var percentage = 0;
            //var progressText = "";

            //Ext.TaskManager.start({
            //    run: function() {
            //        count++;
            //        if (count > 10) {
            //            progressBar.hide();
            //        }
            //        percentage = count / 10;
            //        progressText = percentage * 100 + "%";
            //        progressBar.updateProgress(percentage, progressText, true);
            //    },
            //    interval: 1000,
            //    //repeat:6
            //});
            //function updatebar(bar) {
            //var msgProgress =   Ext.Msg.progress({
            //    title: "Updating...",
            //    message: "test...",
            //    progress: true,
            //    progressText:"Loading......"
            //});

            /*
                var count = 0;
                var percentage = 0;
                var progressText = "";
                var task = {
                    run: function () {
                        if (count == 10) {
                            Ext.TaskManager.stop(task);
                            Ext.Msg.alert("Fineshed!","更新完成。");
                        }
                        count++;
                        percentage = count / 10;
                        progressText = percentage * 100 + "%";
                        bar.updateProgress(percentage,progressText,"正在更新...");

                    },
                    interval: 1000
                };
                Ext.TaskManager.start(task);
            };*/


            /*
            Ext.MessageBox.alert("窗口标题", "消息内容:这个是用ExtJs5呈现的消息窗口!", function() {
                 Ext.Msg.alert({
                     title: "回调函数中显示的消息窗口",
                     message: "回调函数中显示的消息窗口",
                     icon: Ext.Msg.WARNING,
                     buttons:Ext.Msg.OKCANCEL,
                     fn: function() {
                         Ext.Msg.alert({
                             title: "带图标的消息窗口",
                             msg: "带图标的消息窗口",
                             icon: Ext.Msg.INFO,
                             buttons: Ext.Msg.OK,
                             scope: this,
                             fn: function(id) {
                                 Ext.Msg.confirm("MSG","MSG CONTENT", function(id) {
                                     Ext.Msg.prompt("Prompt", "Content", function () {
                                         
                                         var msgProgress =   Ext.Msg.progress({
                                                 title: "Updating...",
                                                 message: "test...",
                                                 progress: true,
                                                 progressText:"Loading......"
                                             });
                                         //updatebar(msgProgress);
                                         var bar = new Ext.ProgressBar({
                                             width: 300,
                                             cls: "custom",
                                             renderTo: Ext.getBody()
                                         });
                                         bar.wait({
                                             interval: 1000,
                                             duration: 10000,
                                             increment: 10,
                                             text: "请稍候...",
                                             fn: function() {
                                                 bar.updateText("Done!");
                                             }

                                         });
                                         //var count = 0;
                                         //var percentage = 0;
                                         //var progressText = "";
                                         //Ext.TaskManager.start({
                                         //    run: function() {
                                         //        count++;
                                         //        if (count>10) {
                                         //            msgProgress.hide();
                                         //        }
                                         //        percentage = count / 10;
                                         //        progressText = percentage * 100 + "%";
                                         //        msgProgress.updateProgress(percentage,progressText,"正在更新......");
                                         //    },
                                         //    interval:1000
                                         //});
                                     },this,true,id);
                                 },this);
                             }
                         });
                     },
                     scope:this

                 });
             });*/

            // Ext.MessageBox.alert("显示JSON数据", person.name + "<br>" + person["age"] + "<br>" + person.sex + "<br>" + person.books[1].name + "<br>" + person.books[1]["price"]);
            // Ext.Msg.alert(config);
            //Ext.Msg.confirm("Title","Message", function(id) {
            //    alert(id);
            //});
            //Ext.Msg.prompt("Title","Message", function(id, content) {
            //    alert(id + content);
            //},this,true,"MetroX");
            // Ext.Msg.wait("Message","Title", { text : ‘DDD...‘});
            //Ext.Msg.alert({
            //    title: "Title",
            //    msg:"Message",
            //    icon: Ext.Msg.INFO,
            //    buttons:Ext.Msg.OK
            //});

            ////var msgBox = Ext.Msg.show({
            ////    title: "Title",
            ////    msg: "Messagse",
            ////    buttons: 6, //Ext.Msg.YESNO,
            ////    icon: Ext.Msg.QUESTION,
            ////    //prompt: true,
            ////    //value: "value",
            ////    progress: true,
            ////    progressText: "Updating...",
            ////    fn: function (id, text) {
            ////        Ext.Msg.alert("Demo", id + text);
            ////    },
            ////    modal: true,
            ////    buttonText: {
            ////        yes: "可以",
            ////        no: "不行"
            ////    }
            ////});


            ////var count = 0;
            ////var percentage = 0;
            ////var progressText = "";
            ////var task = {
            ////    run: function () {
            ////        count++;
            ////        percentage = count / 10;
            ////        progressText = ‘Current: ‘ + percentage * 100 + "%";
            ////        msgBox.updateProgress(percentage, progressText, "TaskDemo : " + Ext.util.Format.date(new Date(), "Y-m-d g:i:s A"));
            ////        if (count == 10) {
            ////            Ext.TaskManager.stop(task);
            ////            msgBox.updateProgress(percentage, "Done!","Finesh!");
            ////            //msgBox.hide();
            ////        }
            ////    },
            ////    interval:1000
            ////};
            ////Ext.TaskManager.start(task);

            //var config = {
            //    title: "配置标题",
            //    msg: "配置要显示的消息提示内容!",
            //    closable: false,
            //    icon: Ext.Msg.QUESTION,
            //    buttons: Ext.Msg.OK,
            //    fn: function(id) {
            //        alert("消息框回调函数!" + id);
            //    }
            //};
            //var person = {
            //    name: "MetroX",
            //    age: "30",
            //    sex: "Man",
            //    married: true,
            //    books:[
            //        {
            //            name: "C#入门与提高",
            //            price:"50"
            //        }, {
            //            name: "JavaScript入门与提高",
            //            price: "80"
            //        }
            //    ]
            //};
        });
    </script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
    <form id="form1" runat="server">
    <div id="progressBar">
       <button id="btnShowWin">显示窗口</button>
    </div>
    </form>
</body>
</html>

 

ExtJs demo

标签:

原文地址:http://www.cnblogs.com/linhongquan/p/5470767.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!