【发布时间】:2020-12-25 12:36:10
【问题描述】:
如何在 extjs 的面板中获取选定的文本? 面板 html 属性包含一些格式化的 html 文本,但我只想获取纯文本,而不是格式化的 html 文本。那么,如果用户选择了一些文本,如何获得选择呢?
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.create('Ext.Container', {
renderTo: Ext.getBody(),
items: [{
xtype: 'panel',
title: 'my Panel',
html: "Some text. Let's say for the sake of this question: <i>Lorem ipsum dolor sit amet,...</i>" ,
width: 350
},
{
xtype: 'button',
text: 'my Button',
listeners:{
click: function(){
var selectedText=''; //THIS IS WHERE THE QUESTION IS
alert(selectedText);
}
}
}]
});
}
});
【问题讨论】: