PDA

View Full Version : How to load a XML text to an uneditable field?



pathum
13 Sep 2010, 3:41 AM
Hi,

I am a newbie to Ext and I would like to know the procedure how to do the following.
I have a data store in my webpage, designed by Ext and its being set by a store. For each and every row, there is a button for load a XML message to a new Window same as a pop-up.
I need to implement this using Ext.Window. and I need to add a uneditable field to that window and get the map the XML into that field.
pls help.

p.s: I m using JSON objects to retrive the data from the DB.

Animal
13 Sep 2010, 3:43 AM
"Uneditable field"?

You mean you just want to display some XML?

Animal
13 Sep 2010, 3:44 AM
You could do it like the "View Source" button does in http://dev.sencha.com/deploy/dev/examples/dd/dragdropzones.html

(Which is included in your SDK)

pathum
13 Sep 2010, 6:08 PM
Here's my code. But the browser says there is a JS Error on page.


var message_store = new Ext.data.GroupingStore({
baseParams:{ajax_command:'viewMsg'},
proxy: new Ext.data.HttpProxy({
url:'/connectivity/viewMsgDetails.ajax'
}),
reader: new Ext.data.JsonReader({

root:'archive'
}, Ext.data.Record.create([
{name: 'textArchive'}
])),
groupField:'',
fields: ['textArchive']
});

var message_dataField = new Ext.form.displayField({
value: (message_store.getAt(0)).data.textArchive
});

var messageForm = new Ext.FormPanel({
labelWidth: 200,
frame: true,
displayField: 'textArchive',
draggable: false,
height: 300,
width: 800,
items: message_dataField,
triggerAction: 'all'
});

var viewMessage_window = new Ext.Window({
title: '<%=i18NHelper.getString("view.message","connectivity")%>',
width: 800,
height:300,
floating:true,
shadow:true,
modal:true,
layout: 'fit',
plain:false,
bodyStyle:'padding:5px;',
buttonAlign:'center',
closeAction: 'hide',
draggable :false,
items: messageForm,
buttons: [{
text: '<%=i18NHelper.getString("label.close","connectivity")%>',
handler : function(){
viewMessage_window.hide();
}
}],
listeners: {
scope:this,
beforehide: function(viewMessage_window) {
noSplash();
}
}
});

function showMessageWindow(textArchiveDid) {

message_store.proxy.conn.url = '/connectivity/searchMsgDetails.ajax?textArchivedid='+ textArchiveDid;
message_store.load({params:{start:0, limit:20}});
viewMessage_window.show();
viewMessage_window.setSize(800,300);
viewMessage_window.center();

};

Condor
14 Sep 2010, 12:26 AM
Didn't you ask this question already? You should be loading the form itself and not some store.