2013-10-09 6 views
0

Ниже приведен мой код ExtJs 3.2 для добавления панели сетки в панель формы. Не работает.Как добавить панель сетки в панель формы?

function test(){//will be called after clicking on save, added now 
    var addForm=""; 
    var addGrid=""; 

    addForm=new Ext.FormPanel({ 
     frame: true, 
     items:[ 
       new Ext.form.FormPanel({ 
        title:'Select Start Point', 
        id:'startpoints', 
        autoHeight: false, 
        frame: true, 
        monitorValid: true, 

        items:[{ 
         xtype: 'combo', 
         fieldLabel:'Start Point', 
         width:150, 
         name: 'startpoint', 
         emptyText:'Select Start Point', 
         store:pointstore, 
         mode: 'local', 
         displayField:'start_point', 
         valueField:'start_point', 
         typeAhead: true, 
         triggerAction: 'all', 
         selectOnFocus:true, 
         forceSelection: true, 
         allowBlank:false 


        }], 

       }), 

       new Ext.form.FormPanel({ 
        title:'Select End Point', 
        id:'endpoints', 
        autoHeight: false, 
        frame: true, 
        monitorValid: true, 

        items:[{ 
         xtype: 'combo', 
         fieldLabel:'End Point', 
         width:150, 
         name: 'waypoint', 
         emptyText:'Select End Point', 
         store:pointstore, 
         mode: 'local', 
         displayField:'way_point', 
         valueField:'way_point', 
         typeAhead: true, 
         triggerAction: 'all', 
         selectOnFocus:true, 
         forceSelection: true, 
         allowBlank:false 


        }], 

       }), 
        //way point combo 
        new Ext.form.FormPanel({ 
         title:'Select Way Point', 
         id:'waypoints', 
         autoHeight: false, 
         frame: true, 
         monitorValid: true, 

         items:[{ 
         xtype: 'combo', 
          fieldLabel:'Way Point', 
          width:150, 
          name: 'waypoint', 
          emptyText:'Select Way Point', 
          store: pointstore, 
          mode: 'local', 
          displayField:'way_point', 
          valueField:'way_point', 
          typeAhead: true, 
          triggerAction: 'all', 
          selectOnFocus:true, 
          forceSelection: true, 
          allowBlank:false 


         }], 
         buttonAlign: 'center', 
         buttons:[{ 
          text:'Add' 


         }] 

        }), 

      ],//end of item 



      buttons:[{ 
       text: 'Ok', 
       //logic for Ok 

      },{ 
       text:'Cancel', 
       //logic for Cancel 
       handler: function(){ 
        addWindow.close(); 

       } 

      }] 

    });//end of Form Pannel 

    var grid_panel=new Ext.grid.EditorGridPanel({ 
     id: 'grid', 
     border:true, 
     frame:true, 
     height:150, 
     title:'Way Point Selection', 
     hideHeaders:true, 
     store: pointstore 


    }); 

     addWindow=new Ext.Window({ 
     title: 'Enter Details', 
     closable: false, 
     modal:true, 
     width: 295, 
     autoHeight: true, 
     items: [addForm], 
      items:[grid_panel] 
}).show(); 


}//end of function test 

Я получаю окно, если я прокомментирую "пункты: [grid_panel]". Я хочу добавить панель сетки сразу после кнопки «Добавить», чтобы каждый раз, когда я нажимаю кнопку «Добавить», точки пути должны добавляться в нее. Как это сделать. Пожалуйста, дайте мне код. Я прошел через некоторые аналогичные вопросы, но не были полезны. Я не мог отправить изображение, потому что stackexchange впадина позволяет мне :-(

ответ

1
Ext.create('Ext.form.Panel', { 
      bodyPadding: 10, 
      width: 200, 
      title: 'Languages', 
      items: grid, 
      renderTo: Ext.getBody() 
     }); 

попробовать это ..

+0

Спасибо ... это было полезно – himanshu

1

Есть много, что вы должны научиться .. Вы можете оказать группу элементов в одной панели. Используйте как пункты: [{ххх}, {XXXX}, ..] изменить окно кодирования, как этот

addWindow=new Ext.Window({ 
    title: 'Enter Details', 
    closable: false, 
    modal:true, 
    width: 295, 
    autoHeight: true, 
    items: [{addForm},{grid_panel}], 
    }); 
Смежные вопросы