在combo ext js 4.2中设置定界符的问题

时间:2018-12-03 08:40:55

标签: javascript extjs extjs4.2

我将slash(/)设置为ext js xtype组合中的定界符。在跳出时,定界符再次更改为逗号(,)。仅当我从列表中选择值时,才会发生这种情况。当我粘贴值时,定界符将保持斜线。

我正在ext js网格中使用组合键。

此行为有任何具体原因吗?

Ext.define('PromoMassCopy.view.masscopy.MassCopyGrid', {
  extend: 'Ext.grid.Panel',
  xtype: 'array-grid',
  alias: 'widget.massCopyGrid',
  store: 'MassCopyStore',
  id: 'massCopyGrid',
  width: 500,
  height: 350,
  multiSelect: true,
  autoScroll: true,
  stateful: true,
  stateId: 'stateGrid',
  headerBorders: false,

  viewConfig: {
    enableTextSelection: true
  },

  columns: [
  {
    header: PROMOLABELS["PromoMassCopy.Label.SourceOffer"],
    width: 300,
    dataIndex: 'SOURCEOFFER',
    id: 'SOURCEOFFER'
  }, {
    header: PROMOLABELS["PromoMassCopy.Label.AdWeek"],
    width: 95,
    dataIndex: 'ADWEEK',
    id: 'ADWEEK'
  }, {
    header: PROMOLABELS["PromoMassCopy.Label.Vehicle"],
    width: 300,
    dataIndex: 'VEHICLE',
    id: 'VEHICLE'
  }, {
    header: PROMOLABELS["PromoMassCopy.Label.DestinationOffer"],
    dataIndex: 'DESTINATIONOFFER',
    flex: 1,
    sortable: false,
    editor:
    {
      xtype : 'combo',
      id:'DESTINATIONOFFERCOMBO',
      typeAhead: true,
      triggerAction: 'all',
      allowBlank: true,
      selectOnTab: true,
      displayField: 'promotion',
      valueField: 'promotionID',
      queryMode: 'local',
      autoRenderer:true,
      forceSelection:false,
      store: 'DestinationOfferStore',
      scope: this,
      multiSelect: true,
      delimiter: '/'
    },
    filter:
    {
      type: 'string',
    }

  }
  ],
  selModel : {
    selType : 'checkboxmodel',
    ignoreRightMouseSelection: true,
    checkOnly: true // IMP: Getting cell model issue if flag set to true
  },
  plugins: [
  {
    ptype: 'cellediting',
    clicksToEdit: 1
  },{
      ptype: 'rowexpander',
      rowBodyTpl : [
        '<div class="subGrid"></div>'
      ],
      selectRowOnExpand: false,
      expandOnEnter : false,
      expandOnDblClick : false
  }
  ],

  bbar: [{xtype:'paging'}]
    edit: function(editor, context, eOpts) {

        var errorMsg = Ext.getCmp('promoStatusMessage').html;
        if(errorMsg != null && errorMsg.indexOf("Some offers") != -1) {
            return;
        }

        var gridRow = Ext.getCmp('massCopyGrid').store.getAt(context.rowIdx);
        var sourceOffer = gridRow.data['SOURCEOFFER'];
        var destinationOffers = gridRow.data['DESTINATIONOFFER'];
        destinationOffers = destinationOffers != null ? destinationOffers.toString() : null;
        PromoMassCopy.app.getController('MassCopyController').updateDestinationOffer(sourceOffer, destinationOffers);

        // Re-create the DMDUnit grid
        var subGridDiv = Ext.DomQuery.select('div.subGrid')[context.rowIdx];
        if( subGridDiv.children.length > 0 ) {
          return;
        }

        var dmdUnitStore = Ext.create('Ext.data.Store',
        {
            storeId:'DmdUnitStore' + i,
            fields:['demandUnits', 'description', 'retailPrice', 'effectivePrice'],
            autoLoad: false,
            proxy:{
                type:'ajax',
                url: URIMAP.get('LOADDMDUNITS')
            },
            listeners: {
                load: function(store, records, success) {
                    var grid = Ext.getCmp('tGrid' + (i-1));
                    Ext.each(records, function(item, index) {
                        var row = grid.getView().getNode(index);
                        Ext.fly(row).highlight('#000000', {
                            attr: 'color',
                            duration:9000000
                        });
                    });
                }
            }
        });

        dmdUnitStore.proxy.extraParams = {
            promoOffer: sourceOffer
        };
        dmdUnitStore.load();

        var tgrid = Ext.create('Ext.grid.Panel', {
            store: 'DmdUnitStore' + i,
            id: 'tGrid' + i,
            stateful: true,
            stateId: 'dmdStateGrid',
            disableSelection: true,
            submitValue: false,
            xtype: 'array-grid',
            viewConfig: {
                enableTextSelection: false
            },
            loadMask: true,
            multiSelect: false,
            columns: [
            {
                header: PROMOLABELS["PromoMassCopy.Label.DmdUnits"],
                flex: 1,
                dataIndex: 'demandUnits',
                hideable: false
            },
            {
                header: PROMOLABELS["PromoMassCopy.Label.Description"],
                flex: 1,
                dataIndex: 'description',
                hideable: false
            },
            {
                header: PROMOLABELS["PromoMassCopy.Label.RetailPrice"],
                flex: 1,
                dataIndex: 'retailPrice',
                hideable: false
            },
            {
                header: PROMOLABELS["PromoMassCopy.Label.EffectivePrice"],
                flex: 1,
                dataIndex: 'effectivePrice',
                hideable: false
            }
          ],
          height: 100,
          renderTo: subGridDiv
        });
        i++;
        // Issue: Cannot read property 'isGroupHeader' of null
        tgrid.getEl().swallowEvent([
            'mousedown', 'mouseup', 'click',
            'contextmenu', 'mouseover', 'mouseout',
            'dblclick', 'mousemove'
        ]);
    },
    select : function(selectionModel, record, index, eOpts) {
      PromoMassCopy.app.getController('MassCopyController').updatePromoSelection(record.data, true);
    },
    deselect : function(selectionModel, record, index, eOpts) {
      PromoMassCopy.app.getController('MassCopyController').updatePromoSelection(record.data, false);
    }
  },

  signTpl: '<span style="' +
  'color:{value:sign(\'"#cf4c35"\',\'"#73b51e"\')}"' +
  '>{text}</span>'
      this.callParent();
      var i = 0;
      this.view.on('expandbody', function(rowNode, record, body) {
        var subGridDiv = Ext.DomQuery.select('div.subGrid',body)[0];
        subGridDiv.innerText = '';
        if(subGridDiv.children.length > 0) {
          return;
        }

        var dmdUnitStore = Ext.create('Ext.data.Store',
        {
            storeId:'DmdUnitStore' + i,
            fields:['demandUnits', 'description', 'retailPrice', 'effectivePrice'],
            autoLoad: false,
            proxy:{
                type:'ajax',
                url: URIMAP.get('LOADDMDUNITS')
            },
            listeners: {
                load: function(store, records, success) {
//                    Ext.getCmp('tGrid' + (i-1)).bindStore(store);
                    var grid = Ext.getCmp('tGrid' + (i-1));
                    Ext.each(records, function(item, index) {
                        var row = grid.getView().getNode(index);
                        Ext.fly(row).highlight('#000000', {
                            attr: 'color',
                            duration:9000000
                        });
                    });
                }
            }
        });

        dmdUnitStore.proxy.extraParams = {
         promoOffer: record.data["SOURCEOFFER"]
        };
        dmdUnitStore.load();

        var tgrid = Ext.create('Ext.grid.Panel', {
          store: 'DmdUnitStore' + i,
          id: 'tGrid' + i,
          stateful: true,
          stateId: 'dmdStateGrid',
          disableSelection: true,
          submitValue: false,
          xtype: 'array-grid',
          viewConfig: {
            enableTextSelection: false
          },
          loadMask: true,
          multiSelect: false,
          columns: [
            {
              header: PROMOLABELS["PromoMassCopy.Label.DmdUnits"],
              flex: 1,
              dataIndex: 'demandUnits',
              hideable: false
            },
            {
              header: PROMOLABELS["PromoMassCopy.Label.Description"],
              flex: 1,
              dataIndex: 'description',
              hideable: false
            },
            {
              header: PROMOLABELS["PromoMassCopy.Label.RetailPrice"],
              flex: 1,
              dataIndex: 'retailPrice',
              hideable: false
            },
            {
              header: PROMOLABELS["PromoMassCopy.Label.EffectivePrice"],
              flex: 1,
              dataIndex: 'effectivePrice',
              hideable: false
            }
          ],
          height: 100,
          renderTo: subGridDiv
        });
        i++;
        // Issue: Cannot read property 'isGroupHeader' of null
        tgrid.getEl().swallowEvent([
            'mousedown', 'mouseup', 'click',
            'contextmenu', 'mouseover', 'mouseout',
            'dblclick', 'mousemove'
        ]);
      });
    }
});

0 个答案:

没有答案