日期:2014-05-17  浏览次数:20694 次

ext2.0 实现innerHTML
  最近在搞ext2.0,为了它的效果,一切困难都是值得的。嘿嘿。
  做一个在编辑时,动态增加表单一行的功能,如果用纯js的话就是innerHTML。但是ext2.0有没有封装?或者更好的实现?谢过。
1 楼 fixopen 2008-06-10  
什么是纯 js ?能不能使用 DOM 规范?如果可以使用,那么就完全可以不使用innerHTML。
2 楼 andrew.yulong 2008-06-10  
就是说如果不用ext框架的话可以用innerHTML
  但是我想这普片的功能应该会封装吧?
3 楼 andrew.yulong 2008-06-10  
没有人吗?
  如果是grid动态添加一行的话store.insert的方法
  但是表单的话,FormPanel应该怎么写呢?期待回答
4 楼 andrew.yulong 2008-06-10  
刚刚看API,发现form有个方法
insert( Number index, Ext.Component component ) : Ext.Component
Inserts a Component into this Container at a specified index. Fires the beforeadd event before inserting, then fires ...
Inserts a Component into this Container at a specified index. Fires the beforeadd event before inserting, then fires the add event after the Component has been inserted.
Parameters:

    * index : Number
      The index at which the Component will be inserted into the Container's items collection
    * component : Ext.Component
      The child Component to insert.

      Ext uses lazy rendering, and will only render the inserted Component should it become necessary.

      A Component config object may be passed in order to avoid the overhead of constructing a real Component object if lazy rendering might mean that the inserted Component will not be rendered immediately. To take advantage of this "lazy instantiation", set the Ext.Component.xtype config property to the registered type of the Component wanted.

      For a list of all available xtypes, see Ext.Component.

Returns:

    * Ext.Component
      component The Component (or config object) that was inserted with the Container's default config values applied.



第一个参数应该是行数,第二个参数不知道是什么?
5 楼 andrew.yulong 2008-06-10  
{
                text : ' 返 回 ',
                handler : function() {
                    //newFormWin.hide();
					  var one = new Ext.form.TextField({value : 'one',  
                          name : 'one',  
                          fieldLabel: 'one'  
                     });                     
             		form1.items.add(one);
					form1.render(); 
                }
            }

这样添加,为什么要把火狐地下的小绿点点击一下,动态添加的行才显示出来啊?极度郁闷
6 楼 andrew.yulong 2008-06-10  
其实已经动态增加了一行,但是FormPanel没更新
7 楼 andrew.yulong 2008-06-10  
哎! 搞出来了,结贴