2012-03-01 70 views
1

点击一个按钮,打开一个窗口,其中有一个窗体面板和一个网格。在表单中我有一些组合框,文本框和一个提交按钮。点击提交按钮后,它应该联系数据库并获取值,然后填充网格列。对于特定的作业ID,我们只能从数据库中获得一组值。对于阅读数据库查询,我使用的是“Ext.data.CFQueryReader”。现在我收到一个错误“Ext.data.CFQueryReader不是构造函数”。 由于我对ext js非常陌生,因为我一直在利用其他模块中使用的代码,所以我不确定代码流。所以我的代码会有一些差距。 请在此建议我。以下是我用于此页面的代码片段。如果有其他简单的方法,请告诉我。 我不确定我们是否需要这里的分页工具栏。如果不使用pagingtoolbar,我们如何获取值?Ext.data.CFQueryReader不是构造函数错误

var filterForm = new Ext.form.FormPanel({ 
     title  : 'Filters', 
     floatable   : false, 
     id   : 'filterForm', 
     items  : [ 
     { 
      xtype  : 'combo', 
      id   :'Combo1', 
      fieldLabel  :'Owner', 
      valueField  :'ownerValue', 
      displayField :'ownerDisplay', 
      value  :'ALL' 
     }, 
     { 
      xtype  : 'combo', 
      id   :'Combo2', 
      fieldLabel  :'Status', 
      valueField  :'statusValue', 
      displayField :'statusDisplay', 
      value  :'ALL' 
     }, 
     { 
      xtype  : 'textfield', 
      fieldLabel  : 'job Search', 
      width  : 200, 
      id   :'searchText'  
     } 
     ], 
     buttons: [ 
     { 
      text : 'Apply Filter(s)', 
      id  : 'apply', 
      handler : function(){ 
       loadJobs(); 
      } 
     } 
     ] 

    }); 

var filterGrid = new Ext.grid.GridPanel({ 
     title : 'List', 
     id  : 'list', 
     store : listStore, 

     columns: [ 
      { 
       header  : 'JOBID', 
       width  : 70, 
       dataIndex : 'jobid', 
       sortable : true 
      }, 
      {    
       header  : 'Description', 
       id  : 'description', 
       dataIndex : 'description', 
      }, 
      {    
       header  : 'Category', 
       dataIndex : 'category', 
       width  : 100 
      } 
      ] 
       }); 

function loadJobs() 
{ 
    pagingToolBar.displayMsg = "Displaying {0} - {1} of {2}"; 
    listStore.baseParams.jobid = ''; 
    pagingToolBar.changePage(1); 

} 

var pagingToolBar = new Ext.PagingToolbar({ 
    pageSize : 20, 
    id  : 'pagingToolbar', 
    store : listStore, 
    displayInfo : true, 
    displayMsg : 'Displaying jobs {0} - {1} of {2}' 
}); 

var listStore= new Ext.data.Store({ 
    url   : "/list.cfc", 
    method  : 'POST', 
    reader  : listReader, 
    baseParams : { 
     method  : 'fetchList', 
     returnFormat : 'json', 
     owner  : 'ALL', 
     status  : 'ALL', 
     jobidSearch  : '', 
     jobid  : '' 
    }, 
    listeners : { 
     beforeload : function(store,options){ 
      store.baseParams.email = Ext.getCmp('Combo1').getValue(); 
      store.baseParams.status = Ext.getCmp('Combo2').getValue(); 
      store.baseParams.idSearch =Ext.getCmp('searchText').getValue(); 
     } 
    } 
}); 

var listReader = new Ext.data.CFQueryReader(
    { 
     id   : 'jobid', 
     totalProperty : 'TOTALROWCOUNT' 
    }, 
    [ 
     { name : 'jobid',mapping : 'JOBID',type : 'string'}, 
     { name : 'description',mapping : 'DESCRIPTION',type : 'string'}, 
     { name : 'category',mapping : 'CATEGORY',type :'string'}   
    ] 
); 

回答

0

有你在.html文件添加的CFQueryReader的.js文件containig代码相对路径?

例如,我曾经如下

<script type="text/javascript" src="app/PentahoReader.js"></script> 
+0

感谢解决this.I想到的Ext JS库这将部分本身,所以我没加这个特定库 – user1049057 2012-03-02 06:05:47

+0

我很高兴加入Pentaho的阅读器的路径有效。请记住,无论何时发生此特定错误,都意味着extjs无法找到您的.js文件或名称不正确。 – Shekhar 2012-03-02 11:29:49