<script>
Ext.onReady(function() {
var proxy=new Ext.data.HttpProxy( {url:'jsonaccountlist.php'});
//定义reader
var reader=new Ext.data.JsonReader(
{
root: 'data',
totalProperty: 'totalCount'
},[
{name: 'button'},
{name: 'account_name'},
{name: 'create_time'},
{name: 'account_website'},
{name: 'account_email'}
]
)
//构建Store
var store=new Ext.data.Store( {
autoLoad:{params:{start:0,limit:10}},
proxy:proxy,
reader:reader
});
//载入
store.load();
var grid = new Ext.grid.GridPanel({
title : '表格数据分页',
applyTo : 'grid-div',
id:'a_grid',
width:600,
height:400,
frame:true,
bbar: new Ext.PagingToolbar({//分页工具栏
store : store,
pageSize :10,
displayInfo : true,
displayMsg : '第 {0} 条到 {1} 条,一共 {2} 条',
emptyMsg : "没有记录"
}),
tbar:[{
id:'btnAdd',
text:'新增',
tooltip:'新增',
iconCls:'add',
handler:btAddAccount
}, '-', {
text:'搜索',
tooltip:'搜索',
iconCls:'search',
handler:btSearch
}, '-', {
text:'中文',
tooltip:'中文'
}, '-', {
text:'英文',
tooltip:'英文'
}],
store:store,
columns: [//配置表格列
new Ext.grid.RowNumberer(),//表格行号组件
{header:"",dataIndex:"button",width:130},
{header: "客户姓名", width: 200, dataIndex: 'account_name', sortable: true},
{header: "创建时间", width:100, dataIndex: 'create_time', sortable: true},
{header: "客户网站", width: 200, dataIndex: 'account_website', sortable: true},
{header: "客户邮箱", width: 100, dataIndex: 'account_email', sortable: true}
]
})
function btAddAccount()
{
window.open ("accountedit.php", "newwindow", "height=200, width=400,top=400,left=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") ;
} });
//新增编辑方法
function btEditAccount(account_id){
window.open ("accountedit.php?account_id="+account_id, "newwindow", "height=200, width=400,top=400,left=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") ;
}
function btSearch()
{
//OpenInfo.form.reset();
var OpenInfo=new Ext.form.FormPanel({
width:360,
height:220,
plain:true,
layout:"form",
defaultType:"textfield",
labelWidth:75,
baseCls:"x-plain",
buttonAlign:"center",
bodyStyle:"padding:0 0 0 0",
items:[
{
name:"acc_name",
id:"acc_name",
xtype:'textfield',
fieldLabel:"客户姓名",
baseStyle:'x-plain'
},new Ext.form.DateField({
fieldLabel:'创建日期',
format:'Y年m月d日',//显示日期的格式
width : 150,
name : 'date',
id:'acc_time',
value : new Date()//同步加载数据
})
]});
var OpenInfoWin=new Ext.Window({
title:"查询客户信息",
width:360,
height:220,
plain:true,
iconCls:"addicon",
//不可以随意改变大小
resizable:false,
//是否可以拖动
//draggable:false,
defaultType:"textfield",
labelWidth:100,
collapsible:true, //允许缩放条
closeAction : 'hide',
closable:true,
plain : true,
//弹出模态窗体
modal: 'true',
buttonAlign:"center",
bodyStyle:"padding:10px 0 0 15px",
items:[OpenInfo],
listeners:{
"show":function()
{
OpenInfo.getForm().reset();
//OpenRoomInfofp.getForm().loadRecord(row);
}
},
buttons:[{
text:"查询",
minWidth:70,
handler:function()
{
另一个查询的方法应该怎么写
}
},{
text:"取 消",
minWidth:70,
handler:function()
{
OpenInfoWin.hide();
}
}]
});
OpenInfoWin.show();
}各位帮看看 点击搜索弹出 window 窗口 里面有一个文本框 一个日期控件 点击取消 然后再点搜索弹出的window 控件消失 另一个查询的方法应该怎么写 类似这种Ext.getCmp("a_grid").getStore().load({ params : { start : 0, limit : 10 ,acc_name:Ext.get("acc_name").dom.value ,acc_time:Ext.get("acc_time").dom.value } });
//Ext.getCmp("a_grid").getStore().reload();
OpenInfoWin.hide();
Ext.onReady(function() {
var proxy=new Ext.data.HttpProxy( {url:'jsonaccountlist.php'});
//定义reader
var reader=new Ext.data.JsonReader(
{
root: 'data',
totalProperty: 'totalCount'
},[
{name: 'button'},
{name: 'account_name'},
{name: 'create_time'},
{name: 'account_website'},
{name: 'account_email'}
]
)
//构建Store
var store=new Ext.data.Store( {
autoLoad:{params:{start:0,limit:10}},
proxy:proxy,
reader:reader
});
//载入
store.load();
var grid = new Ext.grid.GridPanel({
title : '表格数据分页',
applyTo : 'grid-div',
id:'a_grid',
width:600,
height:400,
frame:true,
bbar: new Ext.PagingToolbar({//分页工具栏
store : store,
pageSize :10,
displayInfo : true,
displayMsg : '第 {0} 条到 {1} 条,一共 {2} 条',
emptyMsg : "没有记录"
}),
tbar:[{
id:'btnAdd',
text:'新增',
tooltip:'新增',
iconCls:'add',
handler:btAddAccount
}, '-', {
text:'搜索',
tooltip:'搜索',
iconCls:'search',
handler:btSearch
}, '-', {
text:'中文',
tooltip:'中文'
}, '-', {
text:'英文',
tooltip:'英文'
}],
store:store,
columns: [//配置表格列
new Ext.grid.RowNumberer(),//表格行号组件
{header:"",dataIndex:"button",width:130},
{header: "客户姓名", width: 200, dataIndex: 'account_name', sortable: true},
{header: "创建时间", width:100, dataIndex: 'create_time', sortable: true},
{header: "客户网站", width: 200, dataIndex: 'account_website', sortable: true},
{header: "客户邮箱", width: 100, dataIndex: 'account_email', sortable: true}
]
})
function btAddAccount()
{
window.open ("accountedit.php", "newwindow", "height=200, width=400,top=400,left=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") ;
} });
//新增编辑方法
function btEditAccount(account_id){
window.open ("accountedit.php?account_id="+account_id, "newwindow", "height=200, width=400,top=400,left=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") ;
}
function btSearch()
{
//OpenInfo.form.reset();
var OpenInfo=new Ext.form.FormPanel({
width:360,
height:220,
plain:true,
layout:"form",
defaultType:"textfield",
labelWidth:75,
baseCls:"x-plain",
buttonAlign:"center",
bodyStyle:"padding:0 0 0 0",
items:[
{
name:"acc_name",
id:"acc_name",
xtype:'textfield',
fieldLabel:"客户姓名",
baseStyle:'x-plain'
},new Ext.form.DateField({
fieldLabel:'创建日期',
format:'Y年m月d日',//显示日期的格式
width : 150,
name : 'date',
id:'acc_time',
value : new Date()//同步加载数据
})
]});
var OpenInfoWin=new Ext.Window({
title:"查询客户信息",
width:360,
height:220,
plain:true,
iconCls:"addicon",
//不可以随意改变大小
resizable:false,
//是否可以拖动
//draggable:false,
defaultType:"textfield",
labelWidth:100,
collapsible:true, //允许缩放条
closeAction : 'hide',
closable:true,
plain : true,
//弹出模态窗体
modal: 'true',
buttonAlign:"center",
bodyStyle:"padding:10px 0 0 15px",
items:[OpenInfo],
listeners:{
"show":function()
{
OpenInfo.getForm().reset();
//OpenRoomInfofp.getForm().loadRecord(row);
}
},
buttons:[{
text:"查询",
minWidth:70,
handler:function()
{
另一个查询的方法应该怎么写
}
},{
text:"取 消",
minWidth:70,
handler:function()
{
OpenInfoWin.hide();
}
}]
});
OpenInfoWin.show();
}各位帮看看 点击搜索弹出 window 窗口 里面有一个文本框 一个日期控件 点击取消 然后再点搜索弹出的window 控件消失 另一个查询的方法应该怎么写 类似这种Ext.getCmp("a_grid").getStore().load({ params : { start : 0, limit : 10 ,acc_name:Ext.get("acc_name").dom.value ,acc_time:Ext.get("acc_time").dom.value } });
//Ext.getCmp("a_grid").getStore().reload();
OpenInfoWin.hide();
解决方案 »
- jquery ui拖动后保存位置求高人指点
- 服务器无法响应我的请求?
- 焦点获取问题!请各位帮帮小妹!
- document.getElementByid()配合getElementsTagName()使用问题
- jquery 怎么样根据名称获得对应的类型(TYPE)??
- 请问半年日期差值怎么算啊?
- 如何提交表单多个输入框的输入速度
- 请问如何改变iframe中网页上的textbox的内容?
- 为什么用parent.forms[0] 出现parent.forms.0为空或者不是对象?而用parent.具体的form名就不会出现错误?
- this到底指的是谁
- jQuery如何实现某标签内容隐藏显示效果?
- 关于带参数function name(temp)如何获得temp的ID值问题
解决方法:
你去掉这两个字段的id,操作时用form.form.findField(“”)找这个字段值。不要用getCmp();
2.
Ext.apply(store.baseParams, OpenInfo.getForm().getValues(false));
store.load({});
不能当grid有分页时,点击下一页时查询的值传不过去。
2、autoLoad:{params:{start:0,limit:10}},你的参数只有两个,所以默认只传了起始和长度两个参数,这主要是用来分页的,getCmp是获取component的意思,需要该component有id
现在就一个问题了就是点查询",
minWidth:70,
handler:function()
{
另一个查询的方法应该怎么写
}
怎样实现我gird 查询之后的数据 怎么帮定 没有 控件没有id 了怎么传值过去 我的去数据的文件是jsonaccountlist.php' 这个里面的操作都有了各个参数什么的Ext.getCmp("a_grid").getStore().load({ params : { start : 0, limit : 10 ,acc_name:Ext.get("acc_name").dom.value ,acc_time:Ext.get("acc_time").dom.value } }); //Ext.getCmp("a_grid").getStore().reload();
我上面有 store 也有分页控件 还有gird
参数是怎么写的我忘记了你去看下他的demo里有,就是从分页控件里读出来的
store.load({});//之后就会重新加载
这2句话你写在查询按钮里下
{Ext.apply(store.baseParams, OpenInfo.getForm().getValues(false));
store.load({ params : { start : 0, limit : 10 ,acc_name:OpenInfo.form.findField("acc_name").value ,acc_time:OpenInfo.form.findField("acc_time").value } });
}
我是上面那样写的 会报错
OpenInfo.form.findField(...).value' is null or not an object
怎么根据name取值的问题
不好意思这个问题很简单 我刚学3天左右 很多方法都不知道。
另外我那样写 grid 返回的是我根据查询条件之后的数据吗?分页有效果吗?
zoujp_xyz? 分不够可再加 关键是学习
不是value,是getValue() 来取值
{Ext.apply(store.baseParams, OpenInfo.getForm().getValues(false));
store.load({ params : { start : 0, limit : 10 ,acc_name:OpenInfo.form.findField("acc_name").value ,acc_time:OpenInfo.form.findField("acc_time").value } });
}
改成
handler:function()
{Ext.apply(store.baseParams, OpenInfo.getForm().getValues(false));
store.load({});
}
注意到后台处理,然后传回来最记录就OK了
{
Ext.apply(store.baseParams, OpenInfo.getForm().getValues(false));
store.load({ params : { start : 0, limit : 10 ,acc_name:OpenInfo.form.findField("acc_name").getValue() ,acc_time:OpenInfo.form.findField("acc_time").getValue() } });
}我是这样写的 还是报OpenInfo.form.findField(...).value' is null or not an object
看我上面的store 这样写 能能支持查询 分页吗 ?后台jsonaccountlist.php 我已经根据参数处理了
现在的问题是我的handler 写的对吗 ?
写成这样
store.load({ params : { start : 0, limit : 10 ,acc_name:OpenInfo.form.findField("acc_name").getValue() ,acc_time:OpenInfo.form.findField("acc_time").getValue() } });
handler:function()
{Ext.apply(store.baseParams, OpenInfo.getForm().getValues(false));
store.load({});
}
一换结果就出来了
你在北京吗QQ:315136798 可以交个朋友吗
我们公司有很多推荐机会 在财务 ERP 第一