需要解释的语句:1:“Ext.QuickTips.init();”2: var cm = new Ext.grid.ColumnModel([{
           id:'common',
           header: "Common Name",
    中  “id:'common', ” 做什么用的,xml的key不是后面的dataIndex么;
3:editor: new Ext.form.ComboBox({
               typeAhead: true,  
               triggerAction: 'all',
               transform:'light',
               lazyRender:true,
               listClass: 'x-combo-list-small'
            })
中各个属性的含义;4:  "Price"那列中 renderer: 'usMoney',是为了显示$符号,请问还有其他几种格式;5: var Plant = Ext.data.Record.create([
           // the "name" below matches the tag name to read, except "availDate"
           // which is mapped to the tag "availability"
           {name: 'common', type: 'string'},
           {name: 'botanical', type: 'string'},
           {name: 'light'},
           {name: 'price', type: 'float'},             // automatic date conversions
           {name: 'availDate', mapping: 'availability', type: 'date', dateFormat: 'm/d/Y'},
           {name: 'indoor', type: 'bool'}
      ]);
      这段,是否相当于 定义了一个 DataRow Plant ;6: reader: new Ext.data.XmlReader({
               // records will have a "plant" tag
               record: 'plant'
           }, Plant),
    其中 “// records will have a "plant" tag
               record: 'plant'”
     这是什么意思;7: “clicksToEdit:1,” 何意?8:  grid.stopEditing();
     store.insert(0, p);
     grid.startEditing(0, 0);
     为何不管是否 有这句 “grid.startEditing(0, 0);” grid都是可修改的呢?9:  请问 “this.renderer = this.renderer.createDelegate(this);”
     这句话 委托到哪里了? ---〉
         renderer : function(v, p, record){
        p.css += ' x-grid3-check-col-td'; 
        return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-               '+this.id+'">&#160;</div>';}
     这里吗? 这里 return  了什么东西;谢谢了,初学,问题比较多?
    
   

解决方案 »

  1.   

    一点一点来:1:“Ext.QuickTips.init();”这句初始化了QuickTips。这个是用来进行提示的工具。初看上去貌似没什么特别功能。2: var cm = new Ext.grid.ColumnModel([{
              id:'common',
              header: "Common Name",
        中  “id:'common', ” 做什么用的,xml的key不是后面的dataIndex么;这里的id 用于指明ColumModel的id (DOM),与xml无关。在后面可以用Ext.getCmp()获取这个CM。3:editor: new Ext.form.ComboBox({
                  typeAhead: true, 
                  triggerAction: 'all',
                  transform:'light',
                  lazyRender:true,
                  listClass: 'x-combo-list-small'
                })
    中各个属性的含义;
    详见Ext的API中ComboBox部分4:  "Price"那列中 renderer: 'usMoney',是为了显示$符号,请问还有其他几种格式;
    详见Ext的API中Ext.util.Format部分5: var Plant = Ext.data.Record.create([
              // the "name" below matches the tag name to read, except "availDate"
              // which is mapped to the tag "availability"
              {name: 'common', type: 'string'},
              {name: 'botanical', type: 'string'},
              {name: 'light'},
              {name: 'price', type: 'float'},            // automatic date conversions
              {name: 'availDate', mapping: 'availability', type: 'date', dateFormat: 'm/d/Y'},
              {name: 'indoor', type: 'bool'}
          ]);
          这段,是否相当于 定义了一个 DataRow Plant ;
    不是,是定义了一个数据类型,注释里面写的很清楚:"we want to define the Plant record type so we can add records dynamically"。6: reader: new Ext.data.XmlReader({
                  // records will have a "plant" tag
                  record: 'plant'
              }, Plant),
        其中 “// records will have a "plant" tag
                  record: 'plant'”
        这是什么意思;
    这段建立了一个reader,将xml中的plant元素读取到Plant这个解析器中去。7: “clicksToEdit:1,” 何意?
    详见Ext的API中的Ext.grid.EditorGridPanel8:  grid.stopEditing();
        store.insert(0, p);
        grid.startEditing(0, 0);
        为何不管是否 有这句 “grid.startEditing(0, 0);” grid都是可修改的呢?
    是这样的,这里是工具栏上"Add Plant"的处理过程,而不是grid的属性。因此不会影响grid能否修改。9:  请问 “this.renderer = this.renderer.createDelegate(this);”
        这句话 委托到哪里了? ---〉
            renderer : function(v, p, record){
            p.css += ' x-grid3-check-col-td';
            return ' <div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'">&#160; </div>';}
        这里吗? 这里 return  了什么东西; 

    没错。这里声明了Ext.grid.CheckColumn类,renderer中返回的是用于显示checkbox的HTML语句。
      

  2.   

    Ext的API要好好翻翻,没事就翻。
      

  3.   

    1:“Ext.QuickTips.init();” 鼠标悬停,出现的提示框 
    3:editor: new Ext.form.ComboBox({ 
                  typeAhead: true,  输入自动提示
                  triggerAction: 'all', 显示全部
                  transform:'light', 表单上的SELECT
                  lazyRender:true, 防止ComboBox渲染
                  listClass: 'x-combo-list-small' 样式
                }) 
    7: “clicksToEdit:1,” 单机编辑