| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /*
- * @Description:
- * @Author: hy
- * @Date: 2019-08-15 10:27:49
- * @LastEditTime: 2019-08-16 17:13:30
- */
- /**
- * This is an example of using the grid with a RowExpander plugin that adds the ability
- * to have a column in a grid which enables a second row body which expands/contracts.
- *
- * The expand/contract behavior is configurable to react on clicking of the column, double
- * click of the row, and/or hitting enter while a row is selected.
- */
- Ext.define('uas.view.grid.expander.Panel', {
- extend: 'Ext.grid.Panel',
- xtype: 'grid-expander-panel',
- requires: [
- 'Ext.grid.plugin.RowExpander'
- ],
- bind: '{companies}',
- viewModel: {
- stores: {
- companies: {
- type: 'companies',
- autoLoad: true,
- }
- }
- },
- columns: [
- { text: "Company", flex: 1, dataIndex: 'name'},
- { text: "Price", formatter: 'usMoney', dataIndex: 'price', width: 100},
- { text: "Change", dataIndex: 'priceChange', width: 100},
- { text: "% Change", dataIndex: 'priceChangePct', width: 100},
- { text: "Last Updated", formatter: 'date("m/d/Y")', dataIndex: 'priceLastChange', width: 100}
- ],
- plugins: {
- rowexpander: {
- rowBodyTpl: new Ext.XTemplate(
- '<p><b>Company:</b> {name}</p>',
- '<p><b>Change:</b> {change:this.formatChange}</p>',
- {
- formatChange: function (v) {
- var color = v >= 0 ? 'green' : 'red';
- return '<span style="color: ' + color + ';">' +
- Ext.util.Format.usMoney(v) + '</span>';
- }
- })
- }
- }
- });
|