2014-01-15 41 views
0

我在SCRUD上創建一個UI基礎。我的問題是,我在創建一個searchField時遇到了問題,它總是說Ext.ux.form沒有定義。Ext.ux.form is undefined

有人可以幫我解決這個問題嗎?

這是我到目前爲止已經試過:

Ext.ns('Region'); 
Region.app = function() { 
return{ 
    init: function() { 
     Ext.QuickTips.init(); 
     Ext.form.Field.prototype.msgTarget = 'side'; 

     Region.app.AddEditRegion = function(){ 


     }; 

     Region.app.store = new Ext.data.JsonStore({ 
      proxy: new Ext.data.HttpProxy({ 
       url: "<?php echo url_for('/contract_system/index.php/regions')?>", 
       method: "POST" 
      }), 
      reader: new Ext.data.JsonReader({ 
       root: "data", 
       id: "id", 
       totalProperty: "totalCount", 
       fields: [ 

        {name: "id", mapping: "id" }, 
        {name: "description", mapping: "description" } 
       ], 
      }), 
      //data: {data:{id: 1, description: 'test'}}, 
      baseParams: {limit: 20}, 
      remoteSort: false, 
      autoLoad: true 
     }); 


     var addItem = new Ext.Action ({ 
      text: 'Add', 
      // icon: 'images/add1.ico', 
      width: 60, 
      //disabled: true, 


     }); 
     var editItem = new Ext.Action ({ 
      text: 'Edit', 
      // icon: 'images/edit.ico', 
      width: 60, 
      disabled: true, 


     }); 

     var deleteItem = new Ext.Action ({ 
      text: 'Delete', 
      // icon: 'images/delete1.ico', 
      width: 60, 
      disabled: true, 


     });   
         //   

     // var searchField = new Ext.app.SearchField({store: store}); 

     Region.app.empGrid = new Ext.grid.GridPanel({ 

      viewConfig: { 
       forceFit: true, 
       autoFill: true, 
       stripeRows: true 

         // 
     }, 

      listeners: { 

       rowdblclick : Region.app.AddEditRegion, 
       rowcontextmenu: function(grid, rowIndex, e) { 
         e.stopEvent(); 
         grid.getSelectionModel().selectRow(rowIndex); 
         menu_grid.showAt(e.getXY());      
         return false; 
        } 
      }, 

      renderTo: 'region', 
      sm: new Ext.grid.RowSelectionModel({singleSelect: true}), 
      border: false, 
      loadMask: true, 
      frame: false, 
      title: 'Regions', 
      height: 525, 
      anchor: '100%', 
      store: Region.app.store, 
      columns: [ 
       new Ext.grid.RowNumberer(), 
       { 
        header: 'ID', 
        width: 10, 
        sortable: true, 
        locked: true, 
        hidden: false, 
        dataIndex: 'id' 
       },{ 
        header: 'Description', 
        width: 50, 
        sortable: true, 
        locked: true, 
        dataIndex: 'description' 
       } 
       ], 

      tbar: [ 
       'Search : ', 
        new Ext.ux.form.SearchField({ 
         store: Region.app.store, 
         width: 200 
        }),'->',{ 

         xtype: 'toolbar', 
         items: [ 
          addItem, editItem, deleteItem 
         ] 
         } 
       ], 

      bbar: new Ext.PagingToolbar({ 
       pageSize: 20, 
       store: Region.app.store, 
       displayInfo: true, 
       // plugins: new Ext.ux.ProgressBarPager() 
      }) 


     }); 


    } 

} 



}(); 
Ext.onReady(Region.app.init, Region.app); 
+0

什麼版本的extjs是這個? – dbrin

+0

版本extjs 3.4 – sack

回答

0

的Ext.ux.form.SearchField是用戶擴展,並且不包括在ExtJS的庫開箱。你需要在你的頁面中包含這個類的文件。

+0

我需要調用該類到頁面嗎? – sack

+0

不,包括它應該足夠 – dbrin

+0

它現在的作品。謝謝。 – sack