是否可以构建自定义版本来编写类似这样的代码?
<script type="text/javascript">
Ext.scopeResetCSS = true;
var BASE_URL = '<?=base_url()?>';
Ext.BLANK_IMAGE_URL = BASE_URL+'extjs/s.gif';
Ext.onReady(function(){
Ext.create('Ext.data.Store', {
fields : [
{name: 'id', type: 'int'},
{name: 'period', type: 'string'},
{name: 'length', type: 'string'},
{name: 'rooms', type: 'string'},
{name: 'price', type: 'string'},
],
storeId : 'reservationStore',
pageSize : 10,
proxy : {
type : 'ajax',
actionMethods : 'POST',
url : BASE_URL+'transaction/check_reservation',
reader: {
type : 'json',
root : 'data'
}
}
});
Ext.create('Ext.grid.Panel', {
store : Ext.getStore('reservationStore'),
columns : [
{ header: 'ID', dataIndex: 'id', flex: 1},
{ header: 'Period', dataIndex: 'period', flex: 1},
{ header: 'Length', dataIndex: 'length', flex: .5},
{ header: 'Rooms', dataIndex: 'rooms', flex: .5},
{ header: 'Price', dataIndex: 'price', flex: .5}
],
width : 500,
height : 300,
renderTo: 'form1',
});
});
</script>
问候
最佳答案
我认为最好的选择是require。例如:
Ext.require([
'Ext.panel.Panel',
'Ext.grid.Panel'
]);