Javascript 将数据从服务器端加载到ExtJs网格 /*************控制器******************** Ext.define('Insurance.controller.OpenQuoteController'{ 扩展:“Ext.app.Controller”, //定义商店 门店:['OpenQuote'], //定义模型 型号:['ApplicationListData'], //定义视图 视图:['OpenQuoteComp'], 参考文献:[{ 参考:“myGrid”, 选择器:“网格” }], init:函数(){ 这是我的控制({ “视口>面板”:{ render:this.onPanelRendered } }); }, onPanelRendered:函数(){ //只有一个控制台日志来显示面板的渲染时间 console.log(“呈现了面板”); }, onMtai:函数(t){ log('您键入了什么!'); var thisRegEx=newregexp(t.getValue(),“i”); var store=this.getOpenQuoteStore(); var grid=this.getMyGrid(); 存储过滤器(功能(rec){ 对于(var i=0;i
以下是我收到的一些错误:Javascript 将数据从服务器端加载到ExtJs网格 /*************控制器******************** Ext.define('Insurance.controller.OpenQuoteController'{ 扩展:“Ext.app.Controller”, //定义商店 门店:['OpenQuote'], //定义模型 型号:['ApplicationListData'], //定义视图 视图:['OpenQuoteComp'], 参考文献:[{ 参考:“myGrid”, 选择器:“网格” }], init:函数(){ 这是我的控制({ “视口>面板”:{ render:this.onPanelRendered } }); }, onPanelRendered:函数(){ //只有一个控制台日志来显示面板的渲染时间 console.log(“呈现了面板”); }, onMtai:函数(t){ log('您键入了什么!'); var thisRegEx=newregexp(t.getValue(),“i”); var store=this.getOpenQuoteStore(); var grid=this.getMyGrid(); 存储过滤器(功能(rec){ 对于(var i=0;i,javascript,extjs,controller,grid,extjs4,Javascript,Extjs,Controller,Grid,Extjs4,以下是我收到的一些错误: 加载资源失败:服务器响应状态为404(未找到)localhost:8080/extjs/app/view/ [E] [Ext.Loader]无法加载某些请求的文件。ext all rtl debug.js?_dc=1424789229007:5600 未捕获错误:[Ext.Loader]无法加载某些请求的文件。ext all rtl debug.js?_dc=1424789229007:1603 是否有人可以帮助解决这些错误您希望在存储中加载json文件?通过这个地址?
加载资源失败:服务器响应状态为404(未找到)localhost:8080/extjs/app/view/
[E] [Ext.Loader]无法加载某些请求的文件。ext all rtl debug.js?_dc=1424789229007:5600
未捕获错误:[Ext.Loader]无法加载某些请求的文件。ext all rtl debug.js?_dc=1424789229007:1603
是否有人可以帮助解决这些错误您希望在存储中加载json文件?通过这个地址? “localhost:8080/extjs/app/view/OpenQuoteComp.js” 您的控制器方法OpenQuoteComp必须返回JsonResult。。。不是json文件
//****************controller********************
Ext.define('Insurance.controller.OpenQuoteController', {
extend: 'Ext.app.Controller',
//define the stores
stores: ['OpenQuote'],
//define the models
models: ['ApplicationListData'],
//define the views
views: ['OpenQuoteComp'],
refs: [{
ref: 'myGrid',
selector: 'grid'
}],
init: function () {
this.control({
'viewport > panel': {
render: this.onPanelRendered
}
});
},
onPanelRendered: function () {
//just a console log to show when the panel si rendered
console.log('The panel was rendered');
},
onMtai: function (t) {
console.log('You typed something!');
var thisRegEx = new RegExp(t.getValue(), "i");
var store = this.getOpenQuoteStore();
var grid = this.getMyGrid();
store.filterBy(function (rec) {
for (var i = 0; i < grid.columns.length; i++) {
// Do not search the fields that are passed in as omit columns
if (grid.omitColumns) {
if (grid.omitColumns.indexOf(grid.columns[i].dataIndex) === -1) {
if (thisRegEx.test(rec.get(grid.columns[i].dataIndex))) {
if (!grid.filterHidden && grid.columns[i].isHidden()) {
continue;
} else {
return true;
}
;
}
;
}
;
} else {
if (thisRegEx.test(rec.get(grid.columns[i].dataIndex))) {
if (!grid.filterHidden && grid.columns[i].isHidden()) {
continue;
} else {
return true;
}
;
}
;
}
;
}
return false;
});
}
});
//*******************view**************************
Ext.define('Insurance.view.openquote.OpenQuoteComp', {
extend: 'Ext.grid.Panel',
alias: 'widget.OpenQuoteGrid',
title: 'Diary Record(s):0',
width: 700,
xtype: 'openquotecomp',
defaults: {
flex: 1
// layout:'fit'
},
initComponent: function () {
this.columns = [
{header: 'Client Name', dataIndex: 'clientName'},
{header: 'Business Manager', dataIndex: 'bmManger'},
{header: 'Date', dataIndex: 'dealDate', flex: 1},
{header: 'Reference Number', dataIndex: 'refNumber'},
{header: 'Vehicle', dataIndex: 'vehicle'},
{header: 'Agent', dataIndex: 'agent'}
];
this.callParent(arguments);
}
//renderTo: Ext.getBody()
});
//***************model*********************
Ext.define('Insurance.model.ApplicationListData', {
extend: 'Ext.data.Model',
uses: [],
fields: [
{name: 'applicationID', type: 'int'},
{name: 'firstClientName', type: 'string'},
{name: 'secondClientName', type: 'string'},
{name: 'salePerson', type: 'string'},
{name: 'date', type: 'string'},
{name: 'ref', type: 'string'},
{name: 'vehicle', type: 'string'},
{name: 'businessManager', type: 'string'},
{name: 'locumName', type: 'string'},
{name: 'addressLineOneFirstClient', type: 'string'},
{name: 'addressLineOneSecondClient', type: 'string'},
{name: 'addressLineTwoFirstClient', type: 'string'},
{name: 'addressLineTwoSecondClient', type: 'string'},
{name: 'policyNumber', type: 'string'},
{name: 'agentName', type: 'string'},
{name: 'archiveIndicator', type: 'boolean'},
{name: 'createdByWS', type: 'boolean'}
]
});
//***************store****************
Ext.define('Insurance.store.OpenQuote', {
extend: 'Ext.data.Store',
model: 'Insurance.model.ApplicationListData',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'QuoteServlet',
reader: {
type: 'json',
totalProperty: 'totalCount',
root: 'openquote',
successProperty: 'success'
}
}
});
我们如何知道什么在工作或不在工作,或者抛出了什么错误?这取决于您对您的issueFailed to load资源的正确解释:服务器以404(未找到)[E][Ext.Loader]的状态响应某些请求的文件未能加载。ext all rtl debug.js?_dc=1424789229907:5600未捕获错误:[ext.Loader]无法加载某些请求的文件。ext all rtl debug.js?_dc=1424789229907:1603不要将大量更新转储到评论中,请更新问题本身。显然,您有一个路径问题,甚至与显示的代码无关
return Json(new { openquote = "yourDataObject" , totalCount = itemsCount }, JsonRequestBehavior.AllowGet);