]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * This is the base class for {@link Ext.grid.Grid grid} cells that contain only text.\r | |
3 | *\r | |
4 | * {@link Ext.grid.Row Rows} create cells based on the {@link Ext.grid.column.Column#cell}\r | |
5 | * config. Application code would rarely create cells directly.\r | |
6 | */\r | |
7 | Ext.define('Ext.grid.cell.Text', {\r | |
8 | extend: 'Ext.grid.cell.Base',\r | |
9 | xtype: 'textcell',\r | |
10 | \r | |
11 | config: {\r | |
12 | /**\r | |
13 | * @cfg {Boolean} encodeHtml\r | |
14 | * Specify `false` to write HTML directly to the cell. Be aware that doing this\r | |
15 | * can expose your application to security issues if that content is not known to\r | |
16 | * be safe. User input can contain malicious content such as `script` tags and\r | |
17 | * should be scrubbed before directly rendering that HTML.\r | |
18 | */\r | |
19 | encodeHtml: true,\r | |
20 | \r | |
21 | /**\r | |
22 | * @cfg {String} rawValue\r | |
23 | * The text value of the cell. This value will be written to the cell differently\r | |
24 | * based on the {@link #encodeHtml} config. This config is automatically set as a\r | |
25 | * result of setting the {@link #value} config and is rarely set directly. This is\r | |
26 | * a separate config to avoid writting the same formatted result to the DOM.\r | |
27 | * @protected\r | |
28 | */\r | |
29 | rawValue: null\r | |
30 | },\r | |
31 | \r | |
32 | updateRawValue: function (rawValue) {\r | |
33 | var dom = this.innerElement.dom;\r | |
34 | \r | |
35 | if (this.getEncodeHtml()) {\r | |
36 | dom.textContent = rawValue;\r | |
37 | } else {\r | |
38 | dom.innerHTML = rawValue;\r | |
39 | }\r | |
40 | },\r | |
41 | \r | |
42 | updateValue: function() {\r | |
43 | this.writeValue();\r | |
44 | },\r | |
45 | \r | |
46 | writeValue: function() {\r | |
47 | this.setRawValue(this.getValue());\r | |
48 | }\r | |
49 | });\r |