我正在基于SCRUD创建UI。我的问题是我在创建一个searchField时遇到了问题,总是说Ext.ux.form是未定义的。
有人可以帮我解决这个问题吗?
这是我到目前为止所尝试的:
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 :(得分:0)
Ext.ux.form.SearchField是一个用户扩展,并不包含在开箱即用的extjs库中。您需要在页面中包含此类的文件。