开发者

How to replace some text with something in extJS?

Have question: I have in my database some filed with text (i submitted it through form).

Then I have extJS Panel where my data. I made, when i click on soem field, appears message Box with plain text only (But in my database this text is very beautiful with ul's, with /br/'s and so son) :( Its ok, but my eyes can't read this normally! How to avoid this? Maybe in extJS exists some replace params? replace('/n/', '//br/').. or?

my grid

    var Grid = new Ext.grid.GridPanel({
        id          : 'grid',
        store       : store,
        frame       : true,     
        autoScroll  :true,
        columns     : my_columns, 
        stripeRows  : true,
        title       :'Answers',
        iconCls     : 'arrow',
        listeners: {
            celldblclick: function(Grid, rowIndex, cellIndex, e){
                 var rec = Grid.getStore().getAt(rowIndex);
                 var columnName = Grid.getColumnModel().getDataIndex(cellIndex);
                  Ext.Msg.show({
                      title         : 'Message',
                      msg           : rec.get(columnName),
                      modal         : true,
                      autoWidth     : true,
                      maxHeight     : 500,
                      autoScroll    : true,
                      closable      : true,
                      resizable     : false,                              
                      draggable     : false,                          
                      maxWidth      : 500,
                      buttons       : Ext.Msg.OK
                  });
               开发者_StackOverflow中文版   Ext.Msg.getDialog().dd.lock();                    
                }
        }
    });


Hard to understand your problem - you talk about a panel, then you post an example with grid.

Anyway... maybe the problem is that the message dialog window has preventBodyReset: false by default, which means that the default browser styles for <ul> and many other elements are reset.

Unfortunately there is no easy way to set preventBodyReset: true for the message box window. If you want it for all message boxes, then maybe you can achieve something with code like that:

Ext.MessageBox.getDialog().getEl().addClass('x-panel-reset');

If you don't want to apply it globally, then you probably have to create your own message window.


try using the escape function. So something like:

 Ext.Msg.show({
                  title         : 'Message',
                  msg           : escape(rec.get(columnName)),
                  modal         : true,
                  autoWidth     : true,
                  maxHeight     : 500,
                  autoScroll    : true,
                  closable      : true,
                  resizable     : false,                              
                  draggable     : false,                          
                  maxWidth      : 500,
                  buttons       : Ext.Msg.OK
              });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜