PDA

View Full Version : How to do it ? ....



almas
4 Dec 2012, 5:36 AM
I have a little web application. It looks as :
And it is appeared a problem. When I created window by pressing button 'accept' it is ok.I closed window. But if I click one or more times 'accept' the window has to appear.But nothing! Window is not appeared. What is problem, I dont know.(:|

By this 'picture': //*********************************
//***********************************
i labeled the main places.

And You may use screenshots . There are 3.




Ext.require([
'Ext.grid.*',
'Ext.data.*',

]);

Ext.define('Manager', {
extend: 'Ext.data.Model',
fields: ['id', 'name', 'email']
});

Ext.define('Client', {
extend: 'Ext.data.Model',
fields: ['clnt_dcr', 'clnt_owner', 'clnt_n']
});

Ext.onReady(function(){

var myData = [
{id:"170", name:"Vladimie Genri", email:"v.genke@abbyy-ls.com", clnt_dcr : "Here must be something regarding to Client",clnt_owner : "1",clnt_n : "1"},
{id:"127", name:"Sasha Fenster",email:"sf@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "21",clnt_n : "2"},
{id:"21", name:"Anna Dobrinina",email:"a.dobrynina@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "63",clnt_n : "3"},
{id:"63", name:"Ksenia Kuleshova",email:"ksenia_k@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "34",clnt_n : "4"},
{id:"118", name:"Irina Shorova",email:"i.shorova@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "44",clnt_n : "5"},
{id:"102", name:"Tatyana Partin",email:"Tatiana_Par@abbyy.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "161",clnt_n : "6"},
{id:"119", name:"Irakli Tedeeva",email:"i.tedeeva@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "72",clnt_n : "7" },
{id:"180", name:"Yaroslava Bazhanova",email:"y.bazhanova@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "125",clnt_n : "8"},
{id:"99", name:"Isa Gedoin",email:"i.gediun@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "",clnt_n : "9"},
{id:"179", name:"Aleksei Zakharov",email:"a.zakharova@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "21",clnt_n : "10"},
{id:"162", name:"Aser Lebedev",email:"a.lebedeva@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "170",clnt_n : "11"},
{id:"72", name:"Nina Rudinskaya",email:"n.rudinskaya@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "63",clnt_n : "12"},
{id:"125", name:"Oran Didovyk",email:"o.didovyk@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "99",clnt_n : "13" },
{id:"44", name:"Assa sumko",email:"a.sumko@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "72",clnt_n : "14"},
{id:"161", name:"Dmitry Semenovykh",email:"d.semenovykh@abbyy-ls.com" , clnt_dcr : "Here must be something regarding to Client",clnt_owner : "9",clnt_n : "15"}
];

var myIntersecData=[{}];


var managers = Ext.create('Ext.data.Store',
{
fields : ['id', 'name','email'],
data : myData
}
);

var clients = Ext.create('Ext.data.Store',
{
fields : ['clnt_dcr', 'clnt_owner','clnt_n'],
data : myData
}
);

// create the data store
var firstGridStore = Ext.create('Ext.data.Store', {
model: 'Manager',
data: myData
});


// Column Model Managers
var columns = [
{text: "id", flex: 1, sortable: true, dataIndex: 'id'},
{text: "name", width: 70, sortable: true, dataIndex: 'name'},
{text: "email", width: 70, sortable: true, dataIndex: 'email'}
];

// declare the source Grid
var firstGrid = Ext.create('Ext.grid.Panel', {

store : firstGridStore,
columns : columns,
stripeRows : true,
title : 'Main Window',
margins : '0 2 0 0'
});

/* var secondGridStore = Ext.create('Ext.data.Store', {
model: 'Manager'
});
*/



var manCombo=Ext.create('Ext.form.field.ComboBox', {
fieldLabel: 'Manager',
store: managers,
queryMode: 'local',
displayField: 'name',
valueField: 'id'
});

var manButton=Ext.create('Ext.Button', {
text : 'Reset',
scale : 'small',
handler : function() {
manCombo.reset();
}
});

var clientCombo=Ext.create('Ext.form.field.ComboBox', {
fieldLabel: 'Client',
store: clients,
queryMode: 'local',
displayField: 'clnt_n',
valueField: 'clnt_owner'
});

var clientButton=Ext.create('Ext.Button', {
text : 'Reset',
scale : 'small',
//? без height не видно
handler : function() {
clientCombo.reset();
}
});

var clientOrderText=Ext.create('Ext.form.field.Text',{

name:'order',
fieldLabel:'Order',

allowedBlank:false
});

var clientOrderButton=Ext.create('Ext.Button',{

text :'accept',
scale :'small',
handler :function(){
//**********************************************
//**********************************************
changWin.show();
changWin.setTitle(clientOrderText.getValue());

}

});

var clientOrderReset=Ext.create('Ext.Button',{

text :'Reset',
scale :'small',
handler :function(){
clientOrderText.reset();
}

});

var docBox=Ext.create('Ext.form.field.Checkbox',{

boxLabel : 'generated doc only',
name : 'topping',
inputValue: '2',
checked : true,
id : 'checkbox2',
handler :function(){
//here will invoke function that sort client by
}

});

var dateBox=Ext.create('Ext.form.Panel', {

items: [{
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'From',
name: 'from_date',
maxValue: new Date() // limited to the current date or prior
}, {
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'To',
name: 'to_date',
value: new Date() // defaults to today
}]
});

var billnew=Ext.create('Ext.Button',{
margin :5,
text :'Create new bill',
scale :'small',
name :'new_bill',
handler :function(){
//here will invoke function that sort client by
}
});

var fakebillnew=Ext.create('Ext.Button',{
margin :5,
text :'Create new fake bill',
scale :'small',
name :'new_bill_fake',
handler :function(){
//here will invoke function that sort client by
}
});

var resetForm=Ext.create('Ext.Button',{
margin :5,
text :'Reset all froms',
scale :'small',
name :'reset_form',
handler :function(){
//here will invoke function that sort client by
}
});



var secStore=Ext.create('Ext.data.Store',{
fields:['title','count'],
data :[{title:'Bills without Acts',count:''},{title:'Payed bills without Acts',count:''},{title:'Outstanding bills',count:''},{title:'All bills',count:''}]
});

var columns1 = [
{text:'Name',flex: 1, sortable: true, dataIndex: 'title'},
{text:'Value',flex:1, sortable: true, dataIndex: 'count'}
];

// declare the source Grid
var secGrid = Ext.create('Ext.grid.Panel', {
store : secStore,
columns : columns1,
stripeRows : true,

listeners:
{
'click': function()
{
//Ext.create('Ext.window.Window',{title:'Double Clicked !',width:100,height:100}).show();
alert('There is double click !');
},
scope:this
},

margins : '0 1 0 0'
});


//*******************************************************
//*******************************************************
var changWin=Ext.create('Ext.window.Window',{
title :'Chage Value',
layout : {
type: 'vbox',
align: 'stretch',
padding: 5
},
items :[
dateBox,
docBox,
{
xtype:'panel',
layout:{
type:'hbox',
align:'stretch',
cellpadding:5,
margin:10
},
items:[
billnew,
fakebillnew,
resetForm]
}
]
});




//Simple 'border layout' panel to house both grd and panel
var displayPanel = Ext.create('Ext.Panel', {
width : 750,
height : 400,
layout : {
type: 'hbox',
align: 'stretch',
padding: 5
},
renderTo : 'panel',
defaults : { flex : 1 }, //auto stretch
items : [
firstGrid,
{
title:'Admin',
layout:{
type:'vbox',
align:'stretch',
padding:2
},
items:[
{

//? без height не видно
//height:60,
layout:{
type:'hbox',
align:'stretch',
padding:5
},
items:[
manCombo,
manButton
]
},
{

//? без height не видно
//height:60,
layout:{
type:'hbox',
align:'stretch',
padding:5
},
items:[
clientCombo,
clientButton
]
},
{

xtype:'panel',
//? без height не видно
//height:60,
layout:{
type:'hbox',
align:'stretch',
padding:5
},
items:[
clientOrderText,
clientOrderButton,
clientOrderReset
]
},


secGrid
]
}

],
dockedItems: {
xtype: 'toolbar',
dock: 'bottom',
items: ['->', // Fill
{
text: 'Reset Main Window',
handler: function(){
//empty source grid
firstGridStore.loadData([{}]);

}
}]
}
});
});

mitchellsimoens
6 Dec 2012, 7:45 AM
Do you create a new window each time or reuse the same instance?