Coolite Ext.Msg的一些功能及写法

    技术2025-01-09  45

    一、点击BUTTON弹出消息提示框:

    Ext.Msg.Alert("错误提示", "维护工程师为空,请确认维护是否完成!").Show();

    在后台中Show()是必须要加的,否则无任何效果;但在前台JS中写就不需要加Show(),而且alert必须为小写。

     

     

    二、弹出消息提示框并执行方法:

    Ext.Msg.Alert("错误提示", "维护工程师为空,请确认维护是否完成!,new JFunction { Fn = "Search(#{Tree1})" }).Show();

    Search(#{Tree1})为一个JS方法,你可以通过JS方法再调用后台AjaxMethod。

    function Search(tree) { Coolite.AjaxMethods.Query({ success: function(result){ var nodes = eval(result); tree.root.ui.remove(); tree.initChildren(nodes); tree.root.render(); tree.el.unmask(); }, failure: function(msg) { tree.el.unmask(); Ext.Msg.alert('Failure', '未能加载数据'); }});}

     

    [AjaxMethod] public string Query()//重新绑定菜单 { Coolite.Ext.Web.TreeNodeCollection nodes = this.MenuDataBind(); MenuDataBind(); Department(); BindStore("0"); return nodes.ToJson(); }

    其实这里只是告诉大家Ext.Msg可以有这个功能,其实大部分情况下都是在后面直接写方法。

     

    三、弹出YES OR NO提示框:

    [AjaxMethod] public void Delete() { Ext.Msg.Confirm("提示", "注意:会议删除后无法恢复,确定删除?", new MessageBox.ButtonsConfig { Yes = new MessageBox.ButtonConfig { Handler = "Coolite.AjaxMethods.DeleteMeeting();",//调用删除方法 Text = "确定" }, No = new MessageBox.ButtonConfig { Text = "取消" } }).Show(); }

     

    四、弹出会自动消失的提示框:

    public void ShowNotification(string title, string message)//弹出消息提示 { Ext.Notification.Show(new Notification.Config { Icon = Coolite.Ext.Web.Icon.Information, Title = title, AutoHide = true, HideDelay=5000, //控制消失时间(毫秒) Width=300, Height=200, BodyStyle = "align:center", AlignCfg = new Notification.AlignConfig { ElementAnchor = AnchorPoint.BottomRight, TargetAnchor = AnchorPoint.BottomRight, OffsetX = -200, OffsetY = -200 }, ShowFx = new FadeIn { Options = new Coolite.Ext.Web.Fx.Config { Duration = 1 } }, HideFx = new SwitchOff(), Html = message }); }

    最新回复(0)