日期:2014-05-16  浏览次数:20384 次

extjs继承panel实现图片分组功能
Ext.onReady(function() {
ImgGroup = Ext.extend(Ext.Panel, {
     height: 740,
     img_view_id:''+ 'img',
     che_id: '',
     selected_urls: [],
     info: this.info,
       initComponent: function(){
         var cmp = this;
         this.html="";
         for(var i=0;i<this.info.length;i++) {
            this.html+='&nbsp;<img id=\'' + this.img_view_id + i + '\' height=200 width=200px src=\'' + this.info[i].src + '\' >' +
            '<input id=\''+ i +'\' type="checkbox" />';
         }
         ImgGroup.superclass.initComponent.call(this);
      },
      afterRender: function() {
        ImgGroup.superclass.afterRender.call(this);
        var cmp=this;
        for(var j=0;j<this.info.length;j++)
        {
             Ext.get(this.img_view_id+j).parent = this;
            
               Ext.get(cmp.img_view_id+j).on({
                 'click': {fn: function(){
                     for(var i=0;i<cmp.info.length;i++)
                     {
                       if(this.id==cmp.img_view_id+i)
                       {
                            var urlt=cmp.info[i].src;
                            var win=new Ext.Window({
                              e:'window-win',
                              width:  600,
                              height: 700,
                              closeAction: 'hide',
                              closable: true,
                   &nbs