zoukankan      html  css  js  c++  java
  • Extjs4 修改combox中store的数据

        {
              xtype:        "combo",
              fieldLabel:   '选择模板',
              name:        "TemplateType",
              fieldName:   "TemplateType",
              displayField: 'TemplateName',
              valueField:   'SettingId',
              store:        Ext.create('Ext.data.Store', {
                fields: ['SettingId', 'TemplateName', 'Content'],
                data: [{SettingId: 0, TemplateName: '空白模板', Content: ''}]
              }),
                      300,
              labelWidth:   77,
        }
            var templateCombo = this.panel.query("[name=TemplateType]");  //获取combox的元素组件
            if (templateCombo) {
              var storeData = [{SettingId: 0, TemplateName: '空白模板', Content: ''}];
              for(var j=1;j<5;j++){
                storeData.push({SettingId: j, TemplateName: 'TemplateName'+j, Content: 'Content'+j});
              }
              var newStore = Ext.create('Ext.data.Store', {
                fields: ['SettingId', 'TemplateName', 'Content'],
                data: storeData
              })
              templateCombo.bindStore(newStore);

    //之前考虑使用store.loadData(),来修改数据,结果发现在首次加载时,就需要修改数据,无法正常加载,最后就使用了上面的bindStore方法
    }



  • 相关阅读:
    DP实验
    Linux shell学习
    线性排序算法-计数排序
    算法笔试题练习
    堆排序
    node.js初识
    linux下vim命令详解
    html5学习笔记
    有趣的参数收集
    算法学习-归并排序
  • 原文地址:https://www.cnblogs.com/wind-wang/p/11592557.html
Copyright © 2011-2022 走看看