ext.js分页报错 Uncaught TypeError: Cannot read property 'schema' of null 问题如上。这个项目属于二次开发,之前前端都是使用的ext框架。在使用grid分页的时候,浏览器报错Uncaught TypeError: Cannot read property 'schema' of null。使用的ext 的版本是3.x 版本。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var itemsPerPage = 21;var listUrl= "${ctx}/app/load!detail.action";Ext.onReady(function() { alert(1111); gridStore = Ext.create("Ext.data.Store", { remoteSort: true, pageSize:itemsPerPage, baseParams :{ 'extPage.start': 0, 'extPage.limit': itemsPerPage, }, /* listeners: { beforeload: function(b, a) { Ext.apply(b.baseParams, this.baseParams) }, scope: this }, */ proxy: new Ext.data.HttpProxy({ getMethod: function(){ return 'POST'; }, url: listUrl, pageParam: 'extPage.page', limitParam: "extPage.limit", startParam: "extPage.start" }), reader: new Ext.data.JsonReader({ root: "results", totalProperty: "totalCounts", id: "id", fields : ["carCode", "isOverWeight", "licenceColor", "dataTime", "carLineCode", "carShape", "carSpeed", "carWeight", "bearingNum", "oneBearingWeight", "twoBearingWeight", "thrBearingWeight", "fouBearingWeight", "fifBearingWeight", "sixBearingWeight", "othBearingWeight" ] }) }); var seachForm = new Ext.FormPanel({ defaults: { anchor: "0", border: false }, hideBorders: true, frame: false, region: "north", height: 100, border: true, bodyBorder: false, layout: "border", labelWidth: 300, items: [{ layout: "column", defaults: { border: false }, frame: false, region: "center", items: [{ columnWidth: 0.2, layout: "form", defaults: { border: false, anchor: "30%,50%" }, items: [{ xtype: "textfield", fieldLabel: "车牌号", name: "carCode" }, { xtype: "textfield", fieldLabel: "是否超载", name: "isOverWeight" }] },{ columnWidth: 0.2, layout: "form", defaults: { border: false, anchor: "30%,50%" }, items: [{ xtype: "datefield", fieldLabel: "发现时间从", name: "foundTime1", enableKeyEvents: true, format: "Y-m-d" }, { xtype: "datefield", fieldLabel: "到", name: "foundTime2", enableKeyEvents: true, format: "Y-m-d" }] }, { region: "east", xtype: "buttongroup", scope: this, width: 108, frame: false, columns: 2, defaults: { frame: false, border: 0, scale: "small" }, items: [{ xtype: "splitbutton", width: 52, height: 48, frame: false, text: "查询", tooltip: "查询数据", iconAlign: "left", scope: this, arrowAlign: "left", menu: [{ scope: this, handler: function() { seachForm.getForm().reset() }, text: "重置", tooltip: "重置查询条件", iconCls: "menu_rest" }], iconCls: "bt_search", handler: function () { var j = seachForm.getForm().findField("carCode").getValue(); var i = seachForm.getForm().findField("foundTime1").getValue(); var h = seachForm.getForm().findField("foundTime2").getValue(); var g = seachForm.getForm().findField("isOverWeight").getValue(); j = Ext.util.Format.trim(j); this.baseParams = { filter_LIKES_carCode: j, filter_GED_dataTime: i, filter_LED_dataTime: h, filter_EQS_isOverWeight: g, }; gridStore .load({ scope: this }); } }] }] }] }); var gridPanel = Ext.create("Ext.grid.Panel", { frame: false, header: false, border: false, region: "center", trackMouseOver: false, autoScroll: true, store: gridStore , cm: new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({ width: 30, align: "center", header: "序<br/>号" }), { text : "车牌号", dataIndex : "carCode", align : "center", width : 150, renderer:function(v,cellmeta, record, rowIndex, columnIndex, store) { return "<a href='#' onclick='ceshi(\""+record.data.id+"\");' style='margin: 2px 3px;padding: 2px 7px; text-decoration: none'>"+v+"</a>"; } },{ text : "是否超载", dataIndex : "isOverWeight", align : "center", width : 80, renderer : function(v){ if(v == "1"){ v = "超载"; } else if(v == "2" || v == "0"){ v = "未超载"; } else if (v == null){ v = "未超载"; } return v; } }, { text : "车牌颜色", dataIndex : "licenceColor", align : "center", width : 100 }, { text : "时间", dataIndex : "dataTime", align : "center", width : 180 }, { text : "车道号", dataIndex : "carLineCode", align : "center", width : 100, renderer : function(v) { if(v == "01"){ v="单车道上行"; } else if (v == "03"){ v = "单车道下行"; }else if (v <= "13" && v >= "0B"){ v= "多车道上行"; }else if (v <= "27" && v >= "1F"){ v = "多车道下行"; }else if (v == "0A"){ v == "断面调查"; } return v; } }, { text : "车型", dataIndex : "carShape", align : "center", width : 100, renderer : function(v){ if ( v == "01"){ v = "中小客车"; }else if (v == "02"){ v = "大客车"; }else if(v == "03"){ v = "小型货车"; }else if(v == "04"){ v = "中型货车"; }else if(v == "05"){ v = "大型货车"; }else if(v == "06"){ v = "特大型货车"; }else if(v == "07"){ v = "集装箱车"; }else if(v == "08"){ v = "摩托车"; }else if(v == "09"){ v = "拖拉机"; }else if(v == "11"){ v = "小型车"; }else if(v == "12"){ v = "中型车"; }else if(v == "13"){ v = "大型车"; }else if(v == "14"){ v = "特大型车"; }else if(v == "15"){ v = "摩托车"; }else if(v == "16"){ v = "拖拉机"; }else if(v == "21"){ v = "一般机动车"; }else if(v == "22"){ v = "摩托车"; }else{ v = "其他车型"; } return v; } }, { text : "车速(km/h)", dataIndex : "carSpeed", align : "center", width : 100 }, { text : "车重(kg)", dataIndex : "carWeight", align : "center", width : 100 }, { text : "轴数", dataIndex : "bearingNum", align : "center", width : 80 }, { text : "轴一重量(kg)", dataIndex : "oneBearingWeight", align : "center", width : 110 }, { text : "轴二重量(kg)", dataIndex : "twoBearingWeight", align : "center", width : 110 }, { text : "轴三重量(kg)", dataIndex : "thrBearingWeight", align : "center", width : 110 }, { text : "轴四重量(kg)", dataIndex : "fouBearingWeight", align : "center", width : 110 }, { text : "轴五重量(kg)", dataIndex : "fifBearingWeight", align : "center", width : 110 }, { text : "轴六重量(kg)", dataIndex : "sixBearingWeight", align : "center", width : 110 }, { text : "其他轴重量(kg)", dataIndex : "othBearingWeight", align : "center", width : 120 }]), listeners: { afterrender: function(a) { gridStore.load(); Ext.getBody().unmask(); }, scope: this }, bbar: new Ext.PagingToolbar({ pageSize : itemsPerPage, store : gridStore , displayInfo : true, displayMsg : '显示第{0}条到{1}条,记录共{2}条', emptyMsg : '没有记录' }), loadMask: { msg: "正在努力加载,请稍后...." } }); Ext.create("Ext.container.Viewport", { frame: true, layout : "border", border: false, region: "center", items : [ seachForm,gridPanel ] });}); 关于客户端中文的验证 定位显示的问题 请教大家:怎样像论坛回帖那样,点击某个图片后在textarea 中显示该图片,能否给个代码参考下呢?谢谢! 各位达人给我看下这个JS什么错误。(50分求助),急,在线等 求一个停顿、循环的代码。 网页中有个验证码,想做个按钮单独刷新验证码怎么做啊?? firefox下xmlhttp如何正常运行? **slowpoke来拿分** ES5 set如何设置值? 如何使用JS监听本地端口? 只能0打头,后面0\1\2三个数,不能连续重复的正则表达式 手机app中怎么实现下载功能啊
var listUrl= "${ctx}/app/load!detail.action";
Ext.onReady(function() {
alert(1111);
gridStore = Ext.create("Ext.data.Store", {
remoteSort: true,
pageSize:itemsPerPage,
baseParams :{
'extPage.start': 0,
'extPage.limit': itemsPerPage,
},
/* listeners: {
beforeload: function(b, a) {
Ext.apply(b.baseParams, this.baseParams)
},
scope: this
}, */
proxy: new Ext.data.HttpProxy({
getMethod: function(){ return 'POST'; },
url: listUrl,
pageParam: 'extPage.page',
limitParam: "extPage.limit",
startParam: "extPage.start"
}),
reader: new Ext.data.JsonReader({
root: "results",
totalProperty: "totalCounts",
id: "id",
fields : ["carCode", "isOverWeight", "licenceColor", "dataTime", "carLineCode", "carShape", "carSpeed", "carWeight", "bearingNum", "oneBearingWeight", "twoBearingWeight", "thrBearingWeight", "fouBearingWeight",
"fifBearingWeight", "sixBearingWeight", "othBearingWeight" ]
})
});
var seachForm = new Ext.FormPanel({
defaults: {
anchor: "0",
border: false
},
hideBorders: true,
frame: false,
region: "north",
height: 100,
border: true,
bodyBorder: false,
layout: "border",
labelWidth: 300,
items: [{
layout: "column",
defaults: {
border: false
},
frame: false,
region: "center",
items: [{
columnWidth: 0.2,
layout: "form",
defaults: {
border: false,
anchor: "30%,50%"
},
items: [{
xtype: "textfield",
fieldLabel: "车牌号",
name: "carCode"
},
{
xtype: "textfield",
fieldLabel: "是否超载",
name: "isOverWeight"
}]
},{
columnWidth: 0.2,
layout: "form",
defaults: {
border: false,
anchor: "30%,50%"
},
items: [{
xtype: "datefield",
fieldLabel: "发现时间从",
name: "foundTime1",
enableKeyEvents: true,
format: "Y-m-d"
},
{
xtype: "datefield",
fieldLabel: "到",
name: "foundTime2",
enableKeyEvents: true,
format: "Y-m-d"
}]
}, {
region: "east",
xtype: "buttongroup",
scope: this,
width: 108,
frame: false,
columns: 2,
defaults: {
frame: false,
border: 0,
scale: "small"
},
items: [{
xtype: "splitbutton",
width: 52,
height: 48,
frame: false,
text: "查询",
tooltip: "查询数据",
iconAlign: "left",
scope: this,
arrowAlign: "left",
menu: [{
scope: this,
handler: function() {
seachForm.getForm().reset()
},
text: "重置",
tooltip: "重置查询条件",
iconCls: "menu_rest"
}],
iconCls: "bt_search",
handler: function () {
var j = seachForm.getForm().findField("carCode").getValue();
var i = seachForm.getForm().findField("foundTime1").getValue();
var h = seachForm.getForm().findField("foundTime2").getValue();
var g = seachForm.getForm().findField("isOverWeight").getValue();
j = Ext.util.Format.trim(j);
this.baseParams = {
filter_LIKES_carCode: j,
filter_GED_dataTime: i,
filter_LED_dataTime: h,
filter_EQS_isOverWeight: g,
};
gridStore .load({
scope: this
});
}
}]
}]
}]
});
var gridPanel = Ext.create("Ext.grid.Panel", {
frame: false,
header: false,
border: false,
region: "center",
trackMouseOver: false,
autoScroll: true,
store: gridStore ,
cm: new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({
width: 30,
align: "center",
header: "序<br/>号"
}), {
text : "车牌号",
dataIndex : "carCode",
align : "center",
width : 150,
renderer:function(v,cellmeta, record, rowIndex, columnIndex, store) {
return "<a href='#' onclick='ceshi(\""+record.data.id+"\");' style='margin: 2px 3px;padding: 2px 7px; text-decoration: none'>"+v+"</a>";
}
},{
text : "是否超载",
dataIndex : "isOverWeight",
align : "center",
width : 80,
renderer : function(v){
if(v == "1"){
v = "超载";
} else if(v == "2" || v == "0"){
v = "未超载";
} else if (v == null){
v = "未超载";
}
return v;
}
}, {
text : "车牌颜色",
dataIndex : "licenceColor",
align : "center",
width : 100
}, {
text : "时间",
dataIndex : "dataTime",
align : "center",
width : 180
}, {
text : "车道号",
dataIndex : "carLineCode",
align : "center",
width : 100,
renderer : function(v) {
if(v == "01"){
v="单车道上行";
} else if (v == "03"){
v = "单车道下行";
}else if (v <= "13" && v >= "0B"){
v= "多车道上行";
}else if (v <= "27" && v >= "1F"){
v = "多车道下行";
}else if (v == "0A"){
v == "断面调查";
}
return v;
}
}, {
text : "车型",
dataIndex : "carShape",
align : "center",
width : 100,
renderer : function(v){
if ( v == "01"){
v = "中小客车";
}else if (v == "02"){
v = "大客车";
}else if(v == "03"){
v = "小型货车";
}else if(v == "04"){
v = "中型货车";
}else if(v == "05"){
v = "大型货车";
}else if(v == "06"){
v = "特大型货车";
}else if(v == "07"){
v = "集装箱车";
}else if(v == "08"){
v = "摩托车";
}else if(v == "09"){
v = "拖拉机";
}else if(v == "11"){
v = "小型车";
}else if(v == "12"){
v = "中型车";
}else if(v == "13"){
v = "大型车";
}else if(v == "14"){
v = "特大型车";
}else if(v == "15"){
v = "摩托车";
}else if(v == "16"){
v = "拖拉机";
}else if(v == "21"){
v = "一般机动车";
}else if(v == "22"){
v = "摩托车";
}else{
v = "其他车型";
}
return v;
}
}, {
text : "车速(km/h)",
dataIndex : "carSpeed",
align : "center",
width : 100
}, {
text : "车重(kg)",
dataIndex : "carWeight",
align : "center",
width : 100
}, {
text : "轴数",
dataIndex : "bearingNum",
align : "center",
width : 80
}, {
text : "轴一重量(kg)",
dataIndex : "oneBearingWeight",
align : "center",
width : 110
}, {
text : "轴二重量(kg)",
dataIndex : "twoBearingWeight",
align : "center",
width : 110
}, {
text : "轴三重量(kg)",
dataIndex : "thrBearingWeight",
align : "center",
width : 110
}, {
text : "轴四重量(kg)",
dataIndex : "fouBearingWeight",
align : "center",
width : 110
}, {
text : "轴五重量(kg)",
dataIndex : "fifBearingWeight",
align : "center",
width : 110
}, {
text : "轴六重量(kg)",
dataIndex : "sixBearingWeight",
align : "center",
width : 110
}, {
text : "其他轴重量(kg)",
dataIndex : "othBearingWeight",
align : "center",
width : 120
}]),
listeners: {
afterrender: function(a) {
gridStore.load();
Ext.getBody().unmask();
}, scope: this
},
bbar: new Ext.PagingToolbar({
pageSize : itemsPerPage,
store : gridStore ,
displayInfo : true,
displayMsg : '显示第{0}条到{1}条,记录共{2}条',
emptyMsg : '没有记录'
}),
loadMask: {
msg: "正在努力加载,请稍后...."
}
}); Ext.create("Ext.container.Viewport", {
frame: true,
layout : "border",
border: false,
region: "center",
items : [ seachForm,gridPanel ]
});
});