Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何构建自定义extjs4库来编写这样的代码?_Javascript_Extjs_Extjs4 - Fatal编程技术网

Javascript 如何构建自定义extjs4库来编写这样的代码?

Javascript 如何构建自定义extjs4库来编写这样的代码?,javascript,extjs,extjs4,Javascript,Extjs,Extjs4,是否可以构建一个自定义版本来编写这样的代码 <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', { fiel

是否可以构建一个自定义版本来编写这样的代码

<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>

Ext.scopeResetCSS=true;
var BASE_URL='';
Ext.BLANK_IMAGE_URL=BASE_URL+'extjs/s.gif';
Ext.onReady(函数(){
Ext.create('Ext.data.Store'{
字段:[
{name:'id',type:'int'},
{name:'period',type:'string'},
{name:'length',type:'string'},
{name:'rooms',键入:'string'},
{name:'price',键入:'string'},
],
storeId:“reservationStore”,
页面大小:10,
代理:{
键入:“ajax”,
actionMethods:'POST',
url:BASE\u url+“交易/检查预订”,
读者:{
键入:“json”,
root:“数据”
}        
}
});        
Ext.create('Ext.grid.Panel'{
存储:Ext.getStore('reservationStore'),
栏目:[
{header:'ID',dataIndex:'ID',flex:1},
{header:'Period',dataIndex:'Period',flex:1},
{标头:'Length',数据索引:'Length',flex:.5},
{标题:'Rooms',数据索引:'Rooms',flex:.5},
{标题:'Price',数据索引:'Price',flex:.5}
],            
宽度:500,
身高:300,
renderTo:“form1”,
});
});

关于

我认为最好的选择是。例如:


是的,请参见第3节部署:

编辑:

链接到ext.js而不是ext all。启用Ext.Loader和Ext.require以获取所需的文件:

Ext.Loader.setConfig({enabled:true});
Ext.syncRequire(['Ext.data.Store', 'Ext.grid.Panel']);

就我所见,这是标准的ExtJS示例。你在这里看到了什么特别之处?我说的不是加载整个extjs库来运行这段代码,而是构建与这段代码相关的自定义extjs库,尽管已经尝试过了,但不知道如何处理ready中的代码
Ext.Loader.setConfig({enabled:true});
Ext.syncRequire(['Ext.data.Store', 'Ext.grid.Panel']);