extjs 定义window的时候有一个右上角有一个关闭按钮,点击时是隐藏操作,如何让它做关闭操作

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了extjs 定义window的时候有一个右上角有一个关闭按钮,点击时是隐藏操作,如何让它做关闭操作相关的知识,希望对你有一定的参考价值。

以下是关闭操作的代码:

//新增会计期间
function openAddDialog()

//使弹出窗体显示在最前面
Ext.useShims=true;
var win=new Ext.Window(
title:"新增",
width:320,
height:250,
html:addDialogStr,
modal:true,
buttons:[
text:"确认",handler:function()
alert("确认");

//关闭打开的窗体

win.close();

,
text:"取消",handler:function()
win.close();

]
);
win.show();

//点击右上角的关闭按钮后

win.on("close",function()
alert("关闭窗体");

);

对计算机软件的维护主要有以下几点:

(1)对所有的系统软件要做备份。当遇到异常情况或某种偶然原因,可能会破坏系统软件,此时就需要重新安装软件系统,如果没有备份的系统软件,将使计算机难以恢复工作。

(2)对重要的应用程序和数据也应该做备份。

(3)经常注意清理磁盘上无用的文件,以有效地利用磁盘空间。

(4)避免进行非法的软件复制。

(5)经常检测,防止计算机传染上病毒。

(6)为保证计算机正常工作,在必要时利用软件工具对系统区进行保护。

总之,计算机的使用是与维护分不开的,既要注意硬件的维护,又要注意软件的维护。

参考技术A closeAction配置,可以为hide,close
当关闭按钮被点击时执行的动作。“close”缺省的动作是从DOM树中移除window并彻底加以销毁。“hide”是另外一个有效的选项,只是在视觉上通过偏移到零下(negative)的区域的手法来隐藏,这样使得window可通过show 的方法再显示.
The action to take when
the close button is clicked. The default action is 'close' which will actually
remove the window from the DOM and destroy it. The other valid option is 'hide'
which will simply hide the window by setting visibility to hidden and applying
negative offsets, keeping the window available to be redisplayed via the show method.

以下是4.x版本的:
closeAction : String
The action to take when the close header tool is clicked:
'destroy' :
remove the window from the DOM and destroy it and all descendant Components. The window will not be available to be redisplayed via the show method.
'hide' :
hide the window by setting visibility to hidden and applying negative offsets. The window will be available to be redisplayed via the show method.
Note: This behavior has changed! setting does affect the close method which will invoke the approriate closeAction.
Defaults to: "destroy"
区别只是把close改成destory了。
不过建议还是设置为hide好,要不close之后销毁了再次打开窗口的时候就需要重新建立对象了。而hide之后再次打开只需要show()一下就行了。

前提是要配置closable : true,设置窗口为可关闭的,3.x和4.x都需要的。
参考技术B listeners:
"show": function()
form.getForm().loadRecord(record);
,
//按钮关闭操作 ----- 这个地方
"close":function()
//alert("关闭");


);

win.show();
参考技术C

在定义窗口的时候有个配置

closeAction


默认为hide,设置为destroy即可

Ext.create('Ext.window.Window', 
    closeAction: 'destroy'
);

 官方API文档

closeAction : String


The action to take when the close header tool is clicked:


'destroy' :

remove the window from the DOM and destroy it and all descendant Components. The window will not be available to be redisplayed via the show method.


'hide' :

hide the window by setting visibility to hidden and applying negative offsets. The window will be available to be redisplayed via the show method.


Note: This behavior has changed! setting does affect the close method which will invoke the approriate closeAction.


Defaults to: "destroy"

Codeforces Round #245 (Div. 1) B. Working out

题目大意:

有一个人从左上角走到右下角,有一个人从左下角走到右上角。

两个人的路线只能有一个交点。每一个格子都有自己的值,走过这个路径就能获得对应的值。

规定两个人路线的交点的值两个人都不能获得。

求这两个人获得的值得最大值时多少

大致思路:

? 首先先考虑简化的情况:只有一个人的时候,从左上走到右下角所能获得的最大值时多少?

? 这个问题很显然的可以用DP去求,转移方程为:

? (dp[i][j] = max(dp[i-1][j],dp[i][j-1]) +g[i][j])

其中 (g[i][j]) 表示的是这个格子的值,(dp[i][j]) 表示的是走到 (i) 行,(j) 列时所能获得的最大收益。

? 现在把之前的问题进行拓展,变成有两个人的时候,两个人所能获得的最大值是多少。(不考虑路径相交)

这个问题的解也很简单,和上面的一样列一个式子就可以了,不过转移需要稍微变化一下:

? (dp[i][j] = max(dp[i+1][j],dp[i][j-1]) +g[i][j])

现在把问题再拓展成题目中要求的情况。对于这个交点我们可以做出推断:

1.两个路径的交点一定是一个十字形状,且每一个人只能走直线。通过画图很容易就能得到。

2.交点的坐标不可能在边界上,通过画图也能很轻松的看出来。

于是我们可以尝试着去枚举这个交点,复杂度是 (O(n^2)) 的,很OK。

那么对于这个交点,我们需要知道两个人从出发点到这个点的最大值和从这个点分别到右下角与右上角的距离。

对于第一个问题,我们已经通过之前的两个dp式子得到。对于第二个问题,我们可以把实际情况倒过来考虑:

从交点分别到右下角和右上角的距离

变成

分别从右下角和右上角到交点的距离

问题一下子变得熟悉多了,就是之前推出来的那两个式子的变形。

代码:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e3+7;
ll dp1[maxn][maxn],dp2[maxn][maxn],dp3[maxn][maxn],dp4[maxn][maxn];
int g[maxn][maxn];
int main()
{
    //freopen("in.txt","r",stdin);
    ios::sync_with_stdio(false);
    int n,m;
    ll ans=0;
    cin>>n>>m;
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)
            cin>>g[i][j];
    //左上
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)
            dp1[i][j]=max(dp1[i-1][j],dp1[i][j-1])+g[i][j];
    //左下
    for(int i=n;i>=1;--i)
        for(int j=1;j<=m;++j)
            dp2[i][j]=max(dp2[i+1][j],dp2[i][j-1])+g[i][j];
    //右上
    for(int i=1;i<=n;++i)
        for(int j=m;j>=1;--j)
            dp3[i][j]=max(dp3[i-1][j],dp3[i][j+1])+g[i][j];
    //右下
    for(int i=n;i>=1;--i)
        for(int j=m;j>=1;--j)
            dp4[i][j]=max(dp4[i+1][j],dp4[i][j+1])+g[i][j];
    for(int i=2;i<n;++i)
        for(int j=2;j<m;++j){//两种交叉情况,用笔画一画就明白了
            ll p1=dp1[i-1][j]+dp4[i+1][j];
            ll p2=dp2[i][j-1]+dp3[i][j+1];
            ans=max(ans,p1+p2);
            //cout<<"1 "<<i<<" "<<j<<" "<<p1<<" "<<p2<<endl;
            p1=dp1[i][j-1]+dp4[i][j+1];
            p2=dp2[i+1][j]+dp3[i-1][j];
            ans=max(ans,p1+p2);
           // cout<<"2 "<<i<<" "<<j<<" "<<p1<<" "<<p2<<endl;
        }
    cout<<ans<<endl;
    return 0;
}

以上是关于extjs 定义window的时候有一个右上角有一个关闭按钮,点击时是隐藏操作,如何让它做关闭操作的主要内容,如果未能解决你的问题,请参考以下文章

Extjs 窗口默认关闭按钮

用Chrome网页获取PDF?

ExtJs--05--给window组件加入功能条以及子组件获取上级或下级组件的属性和方法

extjs定义grid的列的时候 如何合并列头

extjs 定义grid列的时候 如何根据某个条件隐藏某列

ExtJS4 窗口在 IE 中不关闭