PDA

View Full Version : FormPanel doesn´t load data



serverfreak1982
14 Feb 2010, 10:55 AM
Hi Guys,

I have a grid listing all domains from a customer. On a doubleclick it shall open a new window containing eh form with all details of the domain.

The window with the form shows up but it doesn´t contain any data.

As you can see in the code I tried to use the response of the doubleclick action as parameter for the function that generates my window with the FormPanel.

I also tried to use a url with a hardcoded JSON-String.
This string looks like this:



{"success":true,"data":[{"DomainID":"5","Domain":"example.com","AuthCode":"cv8eUrPT","Creation":"2005-10-11 13:18:28","Expiration":"2010-10-11 00:00:00"}]}

Another FormPanel rendered to a FormPanel shows all data that it retreives from url: in the matching textfield but this FormPanel does not.

Any hints?





function gridDomainList(tabTitel, panel)
{
var Store = new Ext.data.JsonStore({
url: 'domain/getDomainListJSON.php',
root: 'Domains',
idProperty: 'DomainID',
fields: ['DomainID', 'Domain', 'TLD', 'Expiration'],
sortInfo: {
field: 'Domain',
direction: 'ASC' // or 'DESC' (case sensitive for local sorting)
}
});

var grid = new Ext.grid.GridPanel({
width: 800,
height: 500,
frame: true,
title: 'Ihre registrieren Domains',
iconCls: 'icon-grid',
stripeRows: true,

store: Store,

colModel: new Ext.grid.ColumnModel({
defaults: {sortable: true},
columns: [
{header: 'Domainname', dataIndex: 'Domain'},
{header: 'TLD', dataIndex: 'TLD', width: 10, align: 'center'},
{header: 'Ablaufdatum', dataIndex: 'Expiration', width: 15, align: 'center'}
],
}),

viewConfig: {forceFit: true},


/*
listeners: {rowdblclick: function()
{
Ext.Msg.alert('Anmeldung fehlgeschlagen!');
}
},
*/

//listeners: {rowdblclick: getDomainDetails},

/*
bbar: new Ext.PagingToolbar({
pageSize: 15,
store: Store,
displayInfo: true,
displayMsg: 'Zeige Domains {0} - {1} von {2}',
emptyMsg: "No topics to display"

items:[
'-', {
pressed: true,
enableToggle: true,
text: 'Show Preview',
cls: 'x-btn-text-icon details',
toggleHandler: function(btn, pressed){
var view = grid.getView();
view.showPreview = pressed;
view.refresh();
}
}]

}),
*/

sm: new Ext.grid.RowSelectionModel({
singleSelect: true,
})
});

/*
grid.on(
'rowdblclick', getDomainDetails
);

*/
grid.on('rowdblclick', function (grid, rowIndex, e) {
var r = grid.getStore().getAt(rowIndex);
var selectedId = r.get('DomainID');

//Ext.Msg.alert('Hinweis', 'DomainID: '+selectedId);

/*
form.getForm().submit(
{
url: 'domain/getDomainDetailsJSON.php',
params: {DomainID: selectedId},

success: function(grid, action) {
//Ext.Msg.alert('Hinweis', action.response.responseText);
getDomainDetails(action.response.responseText);
},

failure: function(grid, action) {
Ext.Msg.alert('Hinweis', action.response.responseText);
}



});
*/
getDomainDetails();
});



grid.store.load(new Ext.LoadMask(Ext.getBody(), {msg:"Daten werden geladen ...", store: Store}).show());




var form = new Ext.FormPanel({
items: [grid]
});


var tab = panel.getItem(tabTitel);
if(tab){
//tab.getUpdater().update(url);
tab.setTitle(tabTitel);
}
else{
var tab = new Ext.Panel({
title: tabTitel,
id: tabTitel,
closable: true,
scrollable: true,
items: [form]
});

panel.add(tab);
panel.setActiveTab(tab);
panel.render();
}

panel.setActiveTab(tab);
}


function getDomainDetails()
{
var form = new Ext.FormPanel({
labelWidth: 80,
width: 800,
frame: true,
monitorValid: true,
title: 'egal',
url: 'domain/getDomainDetailsJSON.php',
//data: daten,
items: [{
layout:'column',
border: false,
items: [{
layout: 'form',
columnWidth:.5,
border: false,
items:[
{
xtype:'fieldset',
title: 'Allgemeines',
autoHeight: true,
defaults: {width: 230},
defaultType: 'textfield',
collapsed: false,
collapsible: false,

items:[
{
fieldLabel: 'Domain',
name: 'Domain',
allowBlank: false,
}
//{
// id: 'AuthCode',
// fieldLabel: 'AuthCode',
// name: 'AuthCode',
// allowBlank: false,
//},
//{
// fieldLabel: 'Erstellt',
// name: 'Creation',
// allowBlank: false,
//},
// {
// id: 'Expiration',
// fieldLabel: 'Ablauf',
// name: 'Expiration',
// allowBlank: false,
//}
]
},
new Ext.Panel({
border: true,
padding: 5,
title: 'Inhaber',
preventBodyReset: true,
width: 390,
height: 180,
html: 'Inhaber'
}),
new Ext.Panel({
border: true,
padding: 5,
title: 'Tech-C',
preventBodyReset: true,
width: 390,
height: 180,
html: 'Tech-C'
})
]
},
{
width: 5,
height: 1,
border: false,
},
{
layout: 'form',
columnWidth:.5,
border: false,
items:[
{
xtype:'fieldset',
title: 'Allgemein',
autoHeight: true,
defaults: {width: 200},
defaultType: 'textfield',
collapsed: false,
collapsible: false,

items:[/*
{
id: 'ns1',
fieldLabel:'Nameserver',
name:'ns1',
//allowBlank: false,
},
{
id: 'ns2',
fieldLabel:'Nameserver',
name:'ns2',
//allowBlank: false,
},
{
id: 'ns3',
fieldLabel:'Nameserver',
name:'ns3',
//allowBlank: false,
},
{
id: 'ns4',
fieldLabel:'Nameserver',
name:'ns4',
//allowBlank: false,
},
{
id: 'ns5',
fieldLabel:'Nameserver',
name:'ns5',
//allowBlank: false,
}*/
]
},

new Ext.Panel({
border: true,
padding: 5,
title: 'Admin-C',
preventBodyReset: true,
width: 390,
height: 180,
html: 'Admin-C'
}),
new Ext.Panel({
padding: 5,
title: 'Zone-C',
preventBodyReset: true,
width: 390,
height: 180,
html: 'Zone-C'
})


]
}
]
}
]
/*
buttons:[{
text: 'Daten aktualisieren',
formBind: true,
handler: function(){
form.getForm().getEl().dom.action = '';

form.getForm().submit({
method: 'POST',
waitTitle: 'Verbindung',
waitMsg: 'Sende Daten ...',

success: function(){
Ext.Msg.alert('Hinweis', 'Passwort erfolgreich geändert!');
//form.getForm().reset();
},

failure: function(form, action){

if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Es ist ein Fehler aufgetreten.', obj.errors.reason);
}

else{
Ext.Msg.alert('Es ist ein Fehler aufgetreten.', 'Es konnte keine Verbindung zum Server hergestellt werden!');
}
}
})
}
}]
*/
});

var win = new Ext.Window({
//layout: 'border',
width: 810,
height: 650,
title: 'Domaindetails',
closable: true,
resizable: false,
plain: true,
border: true,
items: [form]
});
win.show();
}