David David - 1 month ago 8
Javascript Question

How to display plain text in ExtJs

I have a extJS window. I want to display some text or message which may be response of some server data. Can any body help me how to display ytext on ext JS window. What I need to edit in my code below.

var MyWin = Ext.create('Ext.window.Window', {
title: "My Window",
height: 200,
width: 400,
layout: 'fit',

Thanks for help.


Personally I preferred show server errors whit a simple window and html in it, like And-y shows you can set html of a window, you can do simply that using a function everywere like this:

 var errorShow = function (text) {
            xtype: 'window',
            title: 'Response error',
            width: 200,
            height: 200,
            scrollable: 'y'
    errorShow('<div style="text-align:center;"><h1>Server error</h1>'+
    '<text style="color:red; font-size:1.4em;">404 not found</text><br/>'+
    '<text style="color:blue;">www.error.com/img.jpg</text><br/>'+
    '<text style="color:blue;">Error requiring image</text></div>');

here is a fiddle to show you.

Remember that you should use the same function during every error, setting dimentions on your need. A modal window should be used, to ensure that it will be closed.